欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

nginx配置phpmyadmin虚拟目录的问题

程序员文章站 2024-01-08 08:39:12
...
php

server {listen 80;
server_name ceshi3.com;
#charset koi8-r;
#access_log logs/host.access.log main;

Load configuration files for the default server block.

include /etc/nginx/default.d/*.conf;
location / {
root /www/html/ceshi3.com/htdocs;
index index.html index.php index.htm;
}

pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#

location ~ .php$ {

root html;

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 曾劲松博客

相关标签: php