3
votes

I have a ploblem with nginx shipped with Debian 8 jessie (version 1.6) and php5-fpm. This is a example of my working configuration on nginx 1.2 shipped with Debian 7 wheezy, however, it doesn't 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;
}

Things changed a lot on Debian 8, I modified the stock configuration to get PHP running, a php script showing phpinfo works if it is located 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 lots of options only get 404 / blank page / input file not specified. I think it is a fastcgi_param problem, but don't know how to fix it.

Also, a working config will not work after upgrade, what is the reason of making changes to all of these?

1

1 Answers

0
votes

i worked code

    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;
    }