0

I have nginx 1.4.6 on Ubuntu with php5-fpm 5.5.9 on Ubuntu.

Nginx's config for the WebSite contains:

...
    fastcgi_intercept_errors on;

    access_log /var/log/nginx/dev-vm.domain.com-access.log;
    #error_log /var/log/nginx/dev-vm.domain.com-error.log debug;
    error_log /var/log/nginx/dev-vm.domain.com-error.log error;
...

And a Website's PHP-FPM config with:

...
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/nginx/dev-vm.domain.com-error.log
php_admin_flag[log_errors] = on
...

And php.ini with:

# cat /etc/php5/fpm/php.ini | grep var/log
error_log = /var/log/nginx/php-error.log

A problem is - only *.php files will go to the error log, but without exactly 404 message:

2016/11/15 11:52:03 [error] 47523#0: 39 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 194..*.45, server: dev-vm.domain.com, request: "GET /scsdc.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/dev-vm.domain.com.sock:", host: "dev-vm.domain.com"

But images 404 - still going to access.log instead of error.log:

194...45 - - [15/Nov/2016:11:54:53 +0000] "GET /wp-content/uploads/2016/10/160829_netzeband_183-1.jpg HTTP/1.1" 404 18168 "http://dev-vm.domain.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/53.0.2785.143 Chrome/53.0.2785.143 Safari/537.36"

What I missed here?

That's not my first WordPress on NGINX+PHP-FPM setup, and on another host - I have it working pretty well:

# cat /var/log/nginx/vhosts/anotherdomain/anotherdomain.co.ua-error.log | grep 404 | wc -l
325596
  • 4
    The error log is to record problems with your server, not that some random user mistyped a URL. – Richard Smith Nov 15 '16 at 13:20
  • What kind of entries for 404 error codes are on the server where it works "pretty well"? – Tero Kilkanen Nov 15 '16 at 15:47
  • @TeroKilkanen open() "/var/www/vhosts/host/host.co.ua/wp-content/uploads/2013/07/ssh_logo.jpg" failed (2: No such file or directory) - for example. Image's 404 error message. – setevoy Nov 15 '16 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.