4

This is my error.log from nginx:

2014/10/02 14:51:29 [error] 15936#0: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 134.106.87.55, server: sumomo.shitteru2.net, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "sumomo.shitteru2.net"

this is my enabled site:

server {
     listen 80;
     server_name sumomo.shitteru2.net;

     index index.php index.html index.htm;

     location / {
             root /mnt/firstsite;
     }

     location ~ [^/]\.php(/|$) {
             fastcgi_split_path_info ^(.+?\.php)(/.*)$;
             if (!-f $document_root$fastcgi_script_name) {
                     return 404;
             }
             fastcgi_pass unix:/var/run/php5-fpm.sock;
             fastcgi_index index.php;
             include fastcgi_params;
     }
}

As far as I can see everything is very simple so it should work. I even copied it directly from http://wiki.nginx.org/PHPFcgiExample#Connecting_nginx_to_PHP_FPM. Do you guys see any potential problems?

1

1 Answer 1

0

I made a solution I can use everywhere in /etc/nginx/snippets/common.conf:

index index.php index.html index.htm index.nginx-debian.html;
location ~ \.php$
{                                                                                
    include snippets/fastcgi-php.conf;                                                                                      
    # With php5-fpm:                                                                                                        
    fastcgi_pass unix:/var/run/php5-fpm.sock;    
}

And now all my site config files look very simple:

server {
    listen 80;
    listen [::]:80;

    server_name do-it-big.com www.do-it-big.com;
    root /var/www/doitbig;
    client_max_body_size 10m;
    include snippets/common.conf;
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.