Nginx 1.6 alias + php5-fpm = 404 on Debian 8
I have a ploblem with nginx shipped with Debian 8 jessie (version 1.6) and php5-fpm. This is an example of my working configuration on nginx 1.2 shipped with Debian 7 wheezy, however it does not work on 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;
}
}
and this is my 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;
}
A lot has changed in Debian 8, I changed the stock config to run PHP, the php script shows that phpinfo is working if it's in / var / www / html.
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;
}
}
}
However, http: // localhost / phpmyadmin doesn't work (404), tried many options, only 404 / empty / input file not specified. I think this is a fastcgi_param issue, but don't know how to fix it.
In addition, after the update the working config will not work, what is the reason for making changes to all this?
+3
source to share
1 answer
i the code worked
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;
}
0
source to share