Я недавно начал использовать Nginx с php-fpm.Все выглядит хорошо, за исключением случая, когда я получаю «Входной файл не указан» и 404 регистрируется в access.log.Это выглядит случайным, когда один запрос получает 200, а другой запрос к тому же файлу получает 404 с вышеуказанной ошибкой.Связанные ошибки не найдены ни в Nginx, ни в php-fpm error.log.
Вот выдержка из файла access.log:
10.0.0.5 - - [09/Aug/2011:18:14:27 -0400] 200 "POST /services/ChangeAccount HTTP/1.1" 110 "http://slotspot-internal.blitzoo.com/" "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0" "94.49.122.184"
10.0.0.5 - - [09/Aug/2011:18:15:27 -0400] 404 "POST /services/ChangeAccount HTTP/1.1" 36 "http://slotspot-internal.blitzoo.com/" "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0" "94.49.122.184"
10.0.0.5 - - [09/Aug/2011:18:15:28 -0400] 200 "POST /services/ChangeAccount HTTP/1.1" 110 "http://slotspot-internal.blitzoo.com/" "Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0" "94.49.122.184"
Мы провели некоторое исследование и убедились, что корень документаопределяется в блоке конфигурации сервера Nginx, а fastcgi_param SCRIPT_FILENAME определяется как $ document_root $ fastcgi_script_name
Вот мой nginx.conf:
user nginx nginx;
worker_processes 5;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
}
http {
include /etc/nginx/mime.types;
include /etc/nginx/proxy.conf;
include /etc/nginx/fastcgi.conf;
index index.html index.htm index.php;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts
server {
listen 80;
server_name _;
root /opt/myapp/current/server/public;
location / {
root /opt/myapp/current/server/public;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
location ~ /admin {
rewrite ^/admin(.*)$ /router.php last;
}
location ~ /index/ {
rewrite ^/index/(.*)$ /router.php last;
}
location ~ /services/ {
rewrite ^/services/(.*)$ /router.php last;
}
location ~ /skupdater/ {
rewrite ^/skupdater/(.*)$ /router.php last;
}
location ~ \.php$ {
root /opt/myapp/current/server/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
}
}
Спасибо всем заранее.