I am looking at an nginx server with php-fpm. I see the access.log directive inside the pool configuration /etc/php5/fpm/pool.d/www.conf

; The access log file
; Default: not set
access.log = /var/log/$pool.php.access.log

However the access log file /var/log/www.php.access.log was not created. I created this file manually but still it was not being populated.

The PHP manual does not list an access.log configuration


This post says that there is no access log for fastcgit

Is there an access log for fastcgi?

So not sure whether the access.log configuration is even valid. What I would like to see is logging of all requests that pass through from nginx to the php application.

Thanks for your help in advance.

  • Please post the full server config.
    – Tim
    Nov 17 '16 at 18:50
  • Here is the php-fpm.conf [global] pid = /var/run/php5-fpm.pid error_log = /var/log/php5-fpm.log include=/etc/php5/fpm/pool.d/*.conf Here is the www.conf inside pool.d [www] user = www-data group = www-data listen = /var/run/php5-fpm.sock listen.owner = www-data listen.group = www-data pm = dynamic pm.max_children = 500 pm.start_servers = 25 pm.min_spare_servers = 25 pm.max_spare_servers = 50 chdir = /
    – anoopjohn
    Nov 17 '16 at 19:53
  • BTW I had commented the access.log statement out because it was not working.
    – anoopjohn
    Nov 17 '16 at 19:56
  • Have you tried to create that file manually with correct permissions?
    – Yarik Dot
    Nov 17 '16 at 20:05
  • Yes, I did create the file with correct permissions. I even tried 666 for the permissions. But that didn't help.
    – anoopjohn
    Nov 17 '16 at 20:09

Did you reload php-fpm? It's OK in my mac.

access.log = /var/log/www.log

Reload php-fpm

kill -USR2 2233

2233 is php-fpm process id

  • Thanks for posting your response. This happened long time back. So not sure how it was handled after that.
    – anoopjohn
    Apr 13 '20 at 2:31

Move your logging to Nginx as PHP-FPM does not have an access log. For more details about PHP-FPM's configuration options see here.

To apply the logging by Nginx you can also use variables but there are constraints to this you may not want to deal with. For details see here.

Nginx config with access log only on PHP level without using variables:

server {
    listen          80;
    listen          [::]:80;
    server_name     www.mysite.com;

    root            /var/www/www.mysite.com;
    access_log      off;

    location / {

    location ~ \.php$ {
            access_log              /var/log/www.log;
  • 1
    You say "PHP-FPM does not have an access log. For more details...", but the link you give is to a page that does document FPM's "access.log" directive. (Maybe you were looking for global directives? It's per-pool.) Jun 8 '17 at 0:24
  • @DominicScheirlinck I think it didn't have at the time
    – Taylan
    Jul 12 '20 at 16:40

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.