我在Debian 8 jessie(版本1.6)和php5-fpm中附带了nginx的问题。这是我在Debian 7中附带的nginx 1.2工作配置的一个例子,然而,它并不适用于1.6。
server {
listen 80;
server_name localhost;
location / {
try_files $uri $uri/ /error.html;
include php.fast.conf;
}
location /phpmyadmin {
alias /usr/share/phpmyadmin;
include php.fast.conf;
}
}
这是我的php.fast.conf
location ~ \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)?$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
Debian 8上的内容发生了很大的变化,我修改了库存配置以使PHP运行,如果phpinfo位于/ var / www / html中,则会显示php脚本。
server {
listen 80;
root /var/www/html;
index index.html index.htm index.php index.nginx-debian.html;
server_name localhost;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location /phpmyadmin {
alias /usr/share/phpmyadmin;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
}
然而http://localhost/phpmyadmin不起作用(404),尝试了很多选项只能获得未指定的404 /空白页/输入文件。我认为这是一个fastcgi_param问题,但不知道如何修复它。
此外,升级后工作配置不起作用,对所有这些进行更改的原因是什么?
答案 0 :(得分:0)
我工作的代码
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
include snippets/fastcgi-php.conf;
root /usr/share/;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_intercept_errors on;
}
location ~* ^/phpmyadmin/(.+\.(jpeg|jpg|png|css|gif|ico|js|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}