php
server {listen 80;
server_name ceshi3.com;
#charset koi8-r;
#access_log logs/host.access.log main;
include /etc/nginx/default.d/*.conf;
location / {
root /www/html/ceshi3.com/htdocs;
index index.html index.php index.htm;
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /www/html/ceshi3.com/htdocs$fastcgi_script_name;
include fastcgi_params;
}
location /phpmyadmin {
alias /usr/share/phpMyAdmin/;
index index.php;}
location ~ /phpmyadmin/.+.php$ {
if ($fastcgi_script_name ~ /phpmyadmin/(.+.php.*)$) {
set $valid_fastcgi_script_name $1;}
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin/$valid_fastcgi_script_name;
}
}但是这样配置之后phpmyadmin打不开,phpmyadmin不在网站根目录下,用的alias定义虚拟目录,如果我把 location ~ .php$这个删掉,phpmyadmin就可以打开了,但是这样网站首页如果是php的,那么打开首页就会变成下载php文件了,说明php解析不成功,这是怎么回事!
以上语法有错误吗,为什么有冲突呢?
http://kimsom.com 曾劲松博客