Personal computing discussed

Moderators: renee, Dposcorp

 
Crayon Shin Chan
Minister of Gerbil Affairs
Topic Author
Posts: 2313
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia
Contact:

nginx won't see my PHP!

Sat Nov 10, 2012 3:30 am

This has me pulling my hair out, and that's not the thing I need first thing in the morning! Whenever I access "index.htm" in /var/www, it dutifully comes up, but with php.php (which is in the same directory) it doesn't come up. Without the try_files $uri =404; it simply says "File not found"; with that line, it actually gives me a 404 error, so it sounds like it really can't find it.

Meanwhile, error.log says
2012/11/10 09:23:36 [error] 7891#0: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 77.188.254.18, server: vps18089.ovh.net, request: "GET /php.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "vps18089.ovh.net"


Here's my /etc/nginx/sites-available/default file:
server {

        listen   80; ## listen for ipv4
#       listen   [::]:80 default ipv6only=on; ## listen for ipv6

        server_name  somewhere ;) ;

        access_log  /var/log/nginx/localhost.access.log;

        location / {
                root   /var/www;
                index  index.html index.htm;
        }

        #error_page  404  /404.html;

        # redirect server error pages to the static page /50x.html
        #
        #error_page   500 502 503 504  /50x.html;
        #location = /50x.html {
        #       root   /var/www/nginx-default;
        #}

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
                #proxy_pass   http://127.0.0.1;
        #}

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

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
                #deny  all;
        #}
}
Mothership: FX-8350, 12GB DDR3, M5A99X EVO, MSI GTX 1070 Sea Hawk, Crucial MX500 500GB
Supply ship: [email protected], 12GB DDR3, M4A88TD-V EVO/USB3
Corsair: Thinkpad X230

Who is online

Users browsing this forum: No registered users and 12 guests
GZIP: On