Personal computing discussed

Moderator: Dposcorp

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

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:, server:, request: "GET /php.php HTTP/1.1", upstream: "fastcgi://", host: ""

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
        #location ~ \.php$ {

        #pass the PHP scripts to FastCGI server listening on

        location ~ \.php$ {
                try_files $uri =404;
                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

Who is online

Users browsing this forum: No registered users and 2 guests