Temporary "File not found" error

blubb123 nginx-forum at nginx.us
Sun Jan 20 12:38:46 UTC 2013

About one month ago I had set up a new server configuration, since then I
struggle with an annoying temporary error.
Most of the time everything works fine, but after some period of time, I
sometimes receive "File not found" errors when I try to acces a PHP file.

access log:
a.b.c.d - - [20/Jan/2013:13:14:38 +0100] "GET /intern/phpMyAdmin/ HTTP/1.1"
404 47 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101
Firefox/18.0" "-"
a.b.c.d - - [20/Jan/2013:13:14:39 +0100] "GET /intern/phpMyAdmin/ HTTP/1.1"
200 2378 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0)
Gecko/20100101 Firefox/18.0" "-"

error log:
2013/01/20 13:14:38 [error] 26428#0: *6892 FastCGI sent in stderr: "Primary
script unknown" while reading response header from upstream, client:
a.b.c.d, server: abc.de, request: "GET /intern/phpMyAdmin/ HTTP/1.1",
upstream: "fastcgi://", host: "abc.de"

Two request, the first on throws an error, the second one is fine. 
So there is only one of the two php-fpm workers affected?
Since it is working most of the time, I don't think it has something to do
with file permissions?

Perhaps someone has an idea whats wrong with my configuration?

Thanks in advance!

nginx config:
root            /srv/www/abc.de/public/www;
access_log      /srv/www/abc.de/log/access.log main;
error_log       /srv/www/abc.de/log/error.log warn;

location / {
        index           index.html index.htm index.php;

location ~ \.php$ {
        if ( !-f $request_filename ) {
                return 404;

        include         /etc/nginx/fastcgi_params;
        fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;

        fastcgi_param   DOCUMENT_ROOT           /public/www;
        fastcgi_param   SCRIPT_FILENAME        
        fastcgi_param   PATH_INFO $fastcgi_path_info;
        fastcgi_param   PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_index   index.php;

fastcgi_param   QUERY_STRING            $query_string;
fastcgi_param   REQUEST_METHOD          $request_method;
fastcgi_param   CONTENT_TYPE            $content_type;
fastcgi_param   CONTENT_LENGTH          $content_length;

fastcgi_param   SCRIPT_FILENAME         $request_filename;
fastcgi_param   SCRIPT_NAME             $fastcgi_script_name;
fastcgi_param   REQUEST_URI             $request_uri;
fastcgi_param   DOCUMENT_URI            $document_uri;
fastcgi_param   DOCUMENT_ROOT           $document_root;
fastcgi_param   SERVER_PROTOCOL         $server_protocol;

fastcgi_param   GATEWAY_INTERFACE       CGI/1.1;
fastcgi_param   SERVER_SOFTWARE         nginx/$nginx_version;

fastcgi_param   REMOTE_ADDR             $remote_addr;
fastcgi_param   REMOTE_PORT             $remote_port;
fastcgi_param   SERVER_ADDR             $server_addr;
fastcgi_param   SERVER_PORT             $server_port;
fastcgi_param   SERVER_NAME             $server_name;

fastcgi_param   HTTPS                   $https;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param   REDIRECT_STATUS         200;

fastcgi_connect_timeout 120;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;

php-fpm pool config:
prefix = /srv/www/abc.de/

listen          =
listen.backlog  = -1
listen.allowed_clients =
listen.owner    = www-data
listen.group    = www-data
listen.mode     = 666

user            = www-data
group           = www-data

pm              = dynamic
pm.max_children = 30
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 10
pm.max_requests = 500

pm.status_path  = /php_pool_abc_status
ping.path       = /abc_ping
ping.response   = abc_pong

request_terminate_timeout = 0
request_slowlog_timeout = 1
slowlog         = log/php-slow.log
access.log     = /srv/www/abc.de/log/abc_pool.access.log

chroot          = $prefix
chdir           = /public/

security.limit_extensions = .php .php3 .php4 .php5

; env[PATH]     = /usr/local/bin:/usr/bin:/bin
env[TMP]        = /tmp
env[TMPDIR]     = /tmp
env[TEMP]       = /tmp

php_flag[display_errors]        = off
php_admin_value[error_log]      = /log/php_err.log
php_admin_flag[log_errors]      = on
php_flag[suhosin.session.encrypt] = off

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,235335,235335#msg-235335

More information about the nginx mailing list