nginx won't see my PHP!

The place for all kinds of software for all kinds of operating systems.

Moderator: Dposcorp

nginx won't see my PHP!

Postposted on 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
Code: Select all
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:
Code: Select all
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: Thuban 1055T@3.7GHz, 12GB DDR3, M5A99X EVO, GTX470+Icy Vision Rev.2@840/3800, Vertex 2E 60GB
Supply ship: Sargas@2.8GHz, 12GB DDR3, M4A88TD-V EVO/USB3
Corsair: Macbook Air Ivy Bridge
Crayon Shin Chan
Minister of Gerbil Affairs
 
Posts: 2237
Joined: Fri Sep 06, 2002 11:14 am
Location: Malaysia

Return to General Software

Who is online

Users browsing this forum: No registered users and 3 guests