Question
Unable to open primary script /srv/site1/index.php (PHP-FPM)
$ sudo stat /srv/site1/index.php
File: `/srv/site1/index.php'
Size: 418 Blocks: 8 IO Block: 4096 regular file
Device: 61h/97d Inode: 8139035 Links: 1
Access: (0640/-rw-r-----) Uid: ( 1003/site1) Gid: ( 1003/site1)
Access: 2014-04-23 06:49:13.206065903 +0800
Modify: 2013-11-07 16:04:14.000000000 +0800
Change: 2014-04-23 21:13:32.615981447 +0800
Birth: -
My php-fpm pool:
[site1]
user = site1
group = site1
listen = /var/run/php5-fpm-site1.sock
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 10000
chdir = /srv/site1
My nginx configuration:
server {
listen 80;
server_name site1.x.x.x.x;
root /srv/site1;
client_max_body_size 16M;
keepalive_timeout 10;
index index.html index.php;
set $cache_uri $request_uri;
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
try_files /wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /index.php?$query_string;
location ~ ^/wp-content/cache/minify/[^/]+/(.*)$ {
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1;
}
location ~* .php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm-site1.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* .(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ {
error_log /dev/null crit;
access_log off;
expires 365d;
}
access_log off ;
error_log /var/log/nginx/site1.error.log error;
}
The error:
2014/04/23 21:21:13 [error] 4692#0: *1266 FastCGI sent in stderr: "Unable to open primary script: /srv/site1/index.php (No such file or directory)" while reading response header from upstream, client: 178.255.152.2, server: site1.x.x.x.x, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-site1.sock:", host: "site1.x.x.x.x"
Have I missed something? I seem to have my permissions correct but I can't get nginx + php-fpm to work.
Add a comment
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×