寻觅生命中的那一片浅草......

使用mod_rewrite时要当心MultiViews

使用mod_rewrite时要当心MultiViews

先看我遇到的问题:试图使用如下rewrite代码

RewriteEngine On

RewriteBase /dex/

RewriteRule ^wsdl/(sjz|bd|qhd|common)/?$ wsdl.php?u=$1 [L]

RewriteRule ^wsdl/?$ wsdl.php [L]

达到以下转换效果:

wsdl/sjz –> wsdl.php?u=sjz

wsdl/ –> wsdl.php

但天不随人愿,第二行转换效果没问题,第一行转换效果总是出不来,查了一下RewriteLog,有一句引起了我的注意:

(1) pass through /dex/wsdl/sjz

(3) [per-dir E:/cvswork/2005dex/] add path info postfix: E:/cvswork/2005dex/wsdl.php -> E:/cvswork/2005dex/wsdl.php/sjz

注意看第二句,它怎么把wsdl/sjz转换成了wsdl.php/sjz?难道和第二句RewriteRule有关?试着把第二句RewriteRule关掉,问题依旧。

于是祭起Google海搜,发现有人和我遇到了同样的问题:

the problem lies in here somewhere

with URL http://localhost/index/q we get:-

add path-info postfix: c:/wwwroot/index.php -> c:/wwwroot/index.php/q

strip per-dir prefix: c:/wwwroot/index.php/q -> index.php/q

applying pattern ‘^([^/.]*)$’ to uri ‘index.php/q’

I dont want index.php/q though!!!!! argghhhhh!!!

……

GOT IT!!!!!!!

Bl**dy windows OS

i removed the .htaccess file and http://localhost/phpinfo/x was still doing phpinfo.php

I added a directory called phpinfo and it worked – giving a directory listing

I re-created the .htaccess and voila it worked.

So basically if a directory doesnt exist it looks for a script (.php .html) and then uses that with further parameters sdded to the end of it.

I have to find a workaround for that now.

原来,是Apache在当前目录下找到了wsdl.php(依据wsdl/sjz中的wsdl),并且来了个狸猫换太子,继续搜索……终于在这个德语网页找到了答案:

MultiViews-option abschalten.

wenn diese aktiviert ist, würde ein request nach /kategorie auch kategorie.php finden, und das kollidiert natürlich mit deiner RewriteRule, weil dort eben mit /kategorie/irgendwas ebenfalls ein “treffer” vorliegt – da kann der server also nicht entscheiden, was jetzt eigentlich gemeint ist.

上面是德语,我是看不懂的,用Google翻译如下:

MultiViews option switch off.

if this is activated, after/category kategorie.php to also find request, and collides naturally with your RewriteRule, because evenly with/category/something is likewise present there a “hit” – there the server cannot decide thus, what is now actually meant.

原来是Apache的MultiViews选项干扰了RewriteRule,将其去掉之后,问题排除。

Options -MultiViews

继续寻找MultiViews的相关信息,收获如下:

* Beware of Apache’s Multiviews

* 内容协商(Apache手册中文版mod_negotiation部分)

所以,在没有明确需要的情况下,一般不要打开MultiViews选项,因为我们一般编写的程序很少用到它,反而会给正常的程序调试带来麻烦,另外早期的版本可能还存在一些安全问题。

在去掉MultiViews的同时,发现还有一个好像也没有用的Options——FollowSymLinks,但如果你的 RewriteRule是写在.htaccess文件中的话,FollowSymLinks这个选项可不能去掉,去掉了RewriteEngine就不干活啦~~

转载自:http://doc.linuxpk.com/4941.html

如何找出当前占用磁盘IO最多的进程

linux系统上可以使用(centos 2.6.18-144开始支持),dstat版本至少是:dstat-0.6.7-1.rf.noarch.rpm

安装

wget -c http://linux.web.psi.ch/dist/scientific/5/gfa/all/dstat-0.6.7-1.rf.noarch.rpm

rpm -Uvh dstat-0.6.7-1.rf.noarch.rpm

使用

# dstat -M topio -d -M topbio

—-most-expensive—- -dsk/total- —-most-expensive—-

i/o process      | read  writ|  block i/o process

owl_agent  9642B: 439B|  38k   42k|init       8317B:  41B

nginx         0 :2005B|   0    26k|

gmond         0 :  16k|   0    17k|

gmond         0 : 444B|   0     0 |

其他

低于这个kernel版本的可以参考这个方法:http://www.xaprb.com/blog/2009/08/23/how-to-find-per-process-io-statistics-on-linux/

最后多谢光哥和W总~

转载自:http://www.ourlinux.net/operating-system/how-to-find-per-process-io-statistics-on-linux-2/

telnet on Cygwin

Telnet remote server gives no response on Cygwin

Windows’s telnet doesn’t work on cygwin.We can install inetutils which contains some useful command,such as telnet ftp and so on

inetutils is in Net category.

一个简单的 OpenSolaris 2008.05 VNC 服务器和 GDM 配置示例

我的要求是能够将我的 VNC 客户端连接到一个运行 OpenSolaris 2008.05 的系统,并且能够以超级用户的身份进行登录。我现在已经在一个运行原始 OpenSolaris 2008.05 二进制分发版的系统上成功实现此目标,运行了一个到 snv_91 的完全映像更新之后,在一个运行 OpenSolaris 2008.05 的系统上也实现了此目标。

1. 检查是否安装了 VNC 服务器

VNC 服务器应该已经安装,因为它是 2008.05 二进制分发版的一部分,但我仍然进行了检查。

# pkg info SUNWxvnc
Name: SUNWxvnc
Summary: X11/VNC server
State: Installed
Authority: opensolaris.org (preferred)
Version: 4.1.2
Build Release: 5.11
Branch: 0.91
Packaging Date: Fri Jun 13 17:49:25 2008
Size: 6.3 MB
FMRI: pkg:/SUNWxvnc@4.1.2,5.11-0.91:20080613T174925Z

2. 将此行代码添加到 /etc/services

vnc-server 5900/tcp # Xvnc

3. 按照以下方法编辑 /etc/X11/gdm/custom.conf

[xdmcp]
Enable=true
[security]
DisallowTCP=false
AllowRoot=true
AllowRemoteRoot=true

4. 启用这些服务

# svcadm enable xvnc-inetd
# svcs xvnc-inetd
STATE STIME FMRI
online 16:22:30 svc:/application/x11/xvnc-inetd:default
# svcadm enable gdm
# svcs gdm
STATE STIME FMRI
online 14:43:13 svc:/application/graphical-login/gdm:default

5. 使用 VNC 客户端连接到显示器

您现在应该能够连接到 <hostname>:5900,而且您应该会看到 gdm 登录屏幕。

如果您不能够进行连接,尝试停止并启动这些服务:

# svcadm disable xvnc-inetd gdm
# svcadm enable xvnc-inetd gdm

有一点使我不太满意:当我关闭 VNC 客户端时,与显示器相关联的登录会话似乎退出了。我使用 Solaris 10 和 Solaris Express 时都没有遇到这种现象,它们使用的是 dtlogin,而不是 gdm。如果我找到此问题的解决方案,我会将其添加到本文中。

参考资料:1、2

http://blogs.sun.com/timthomas/entry/a_simple_vnc_server_zh

How to clone an OpenVZ virtual machine

I need sometimes to clone a vps in an openvz environment, so here you can find three methods to do this task:

first option:

# vzctl stop 101
Stopping VE ...
VE was stopped
VE is unmounted
# cp -r /vz/private/101 /vz/private/202
# cp /etc/vz/conf/101.conf /etc/vz/conf/202.conf
# vzctl start 202
Starting VE ...
Initializing quota ...
VE is mounted
Setting CPU units: 1000
VE start in progress...

the second option:

#mkdir /vz/private/new_VEid
#cd /vz/private/old_VEID
#tar cf - * | ( cd /vz/private/new_VEid tar xfp -)
#cp old_VEID.conf new_VEID.conf

and the third option:

# OLDVE=222 NEWVE=333 # Just an example
# vzctl stop $OLDVE
# mkdir /vz/root/$NEWVE
# cp /etc/vz/conf/$OLDVE.conf /etc/vz/conf/$NEWVE.conf
# cp -a /vz/private/$OLDVE /vz/private/$NEWVE
# vzctl start $NEWVE; vzctl start $OLDVE

from:http://www.vioan.ro/wp/2007/07/30/how-to-clone-an-openvz-virtual-machine/
2025年七月
« 5月    
 123456
78910111213
14151617181920
21222324252627
28293031