Home > Backend Development > PHP Tutorial > nginx配置phpmyadmin虚拟目录的问题

nginx配置phpmyadmin虚拟目录的问题

WBOY
Release: 2016-06-02 11:27:29
Original
1377 people have browsed it

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

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template