nginxloggingserverconfigurationaccess-log

NGINX access.log not updating


I've created a simple HTML website with 4 html pages (4 links). The access.log doesn't update for accessing a html page more than once.


E.g. user clicks on link #1 -> link #2 -> link #1

The access.log will only show:

GET /page#1.html

GET /page#2.html

I want it show all requests, i.e.:

GET /page#1.html

GET /page#2.html

GET /page#1.html


I've looked into tailoring my .config file but to no success. Any help will be appreciated. Thank you.

Here is my nginx.config file:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 2048;
    multi_accept on;
}

http {

##
# Basic Settings
##

server_name_in_redirect off;
server_tokens off;
port_in_redirect off;

sendfile on;
tcp_nopush on;
tcp_nodelay off;
send_timeout 30;
keepalive_timeout 60;
keepalive_requests 200;
reset_timedout_connection on;
types_hash_max_size 2048;

server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
#default_type application/octet-stream;
default_type text/html;
charset UTF-8;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;

##
# Gzip Settings
##

gzip on;
gzip_min_length 256;
gzip_disable "msie6";

# gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

Solution

  • As @emix already pointed out, is the browser simply not making a request to your server. Instead the page is most likely going to be served from your browsers cache.

    The (too) short answer to why browsers do this is, is to reduce unnecessary network requests and to save resources.

    To get a better understanding of what a (browser) cache is, I'd recommend you to read the following resources:

    Stackoverflow Q/A:

    External sites: