使用PHP-FPM nginx的從PHP-FPM 1-2分鐘「未指定輸入文件」,PHP-FPM重啓後一切正常OK,除了約1-2分鐘。在此期間,對於全部 .php網址返回「沒有指定輸入文件」。 1-2分鐘後,一切恢復正常,無需採取進一步行動。在/var/log/nginx/error.log後重啓
示例項:
2014/03/04 09:21:22 [error] 1206#0: *55 FastCGI sent in stderr: "Unable to open primary script: /usr/share/nginx/html (Success)", client: xxx.aaa.bbb.ccc, server: www.example.com, request: "GET /xxx/index.php HTTP/1.1", host: "www.example.com"
下面是爲server.conf服務器塊:
server {
listen 443 ssl;
server_name www.example.com;
ssl_certificate /etc/nginx/ssl-bundle.crt;
ssl_certificate_key /etc/nginx/cert.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
root /usr/share/nginx/html;
index index.php index.html;
location/{
try_files $uri $uri/ $uri/index.php;
}
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
而且/etc/nginx/nginx.conf :
http {
...
sendfile on;
keepalive_timeout 65;
charset utf-8;
gzip on;
gzip_static on;
etag on;
upstream php {
server unix:/var/run/php5-fpm.sock;
}
open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
keepalive_requests 100000;
expires max;
include /etc/nginx/conf.d/*.conf;
}
任何想法如何解決它?事實上,它只是在重啓php-fpm後的短暫時間內發生,似乎排除了一些常見問題(例如權限),並且看起來更像是緩存?謝謝!
你如何重新啓動PHP-FPM,你可以發佈池的FPM配置? – Danack
冒着嘗試的風險是隨機的,請將fastcgi_pass行更改爲「fastcgi_pass unix:/var/run/php5-fpm.sock;」 ? – Danack
@Danack使用'/etc/rc.d/init.d/php-fpm restart'(CentOS)重新啓動。我已經在[link](http:// pastebin。)上放了一份'/ etc/php-fpm.d/www.conf'。COM/UcaBxngc)。 – tetech