U
U
uaf0x2019-07-20 16:54:04
Nginx
uaf0x, 2019-07-20 16:54:04

How to enable image logging in nginx?

Hello, access_log does not record image transitions, how can I fix this?
The images are on the server with nginx.
UPD Log

server{
    listen 80;
    server_name site.com www.site.com;
    access_log /var/log/nginx/sfera-http.com.log;
    return 301 https://site.com$request_uri;

}

server {
    listen 443 default ssl http2;
    #listen 159.69.20.128:80 ssl http2;
    #listen 159.69.20.128:443 ssl http2;
    server_name site.com www.site.com;

    ssl on;
    ssl_certificate /home/ssl/site.com.pem;
    ssl_certificate_key /home/ssl/site.com.key;

    access_log /var/log/nginx/access-site.com.log;
    error_log  /var/log/nginx/errors-site.com.log;
    index index.php;
    gzip on;
    gzip_disable "msie6";
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
    
    root /var/www/sfera;
  
    #rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml$ "/index.php?xml_sitemap=params=$2" last;
    #rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last;
    #rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last;
    #rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;


    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ^~ /.well-known {
      allow all;
      auth_basic off;
      alias /var/www/sfera/.well-known/;
    }

    location = /favicon.ico {
        log_not_found off;
        access_log off;
        expires max;
    }

    location ~ \.php$ { 
        try_files $uri =404; 
        include /etc/nginx/fastcgi.conf;
        #fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
      fastcgi_pass  127.0.0.1:9000;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location ~ /\. {
        deny all;
    }

    location ~* \.(css|js|gif|jpg|png|svg|ttf|txt|doc|pdf|rtf|swf|xsl|woff|eot|woff2|ttf|svg|html|ico|less) {
        access_log /var/log/nginx/sfera-images.com.log;
        expires max;
        access_log off;
        log_not_found off;
    }


}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2019-07-20
@ky0

access_log /var/log/nginx/sfera-images.com.log;
access_log off;
log_not_found off;

In the last location. Leave only the first line.

V
Viktor Taran, 2019-07-21
@shambler81

log_not_found off;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question