I have a very basic landing page for a domain of mine. For the last couple days I have been fighting a very peculiar issue.
For example, the directory contains:
vanilla>
./files/
./index.html
./main_style.css
files>
./back.gif
./back1.gif
./logo.png
The contents of index.html:
<!DOCTYPE html>
<html>
<head>
<title>Vanilla</title>
<link rel="stylesheet" type="text/css" href="main_style.css"/>
</head>
<body>
<div>
<img class="logo" src="files/logo.png" />
</div>
</body>
</html>
The contents of main_style.css:
html {
background-image: url("files/back1.gif");
background-repeat: repeat;
}
img.logo {
width: 471px;
height: 384px;
position: absolute;
top: 50%;
left: 50%;
margin-left: -235px;
margin-top: -192px;
}
The problem I'm facing is this:
Immediately following a reboot or something of that sort, and I open the website, all static files load properly, to the versions that are present on the server.
However, beyond this point, if I make a change to the main_style.css, for example, it does not reflect the change whatsoever. Even opening the main_style.css in my browser does not reflect the changes, and it shows the old version of the file.
Also just recently, I renamed a photo from test.png, to logo.png, and changed it accordingly in the index.html. The index.html file reflected the appropriate change, however, it doesn't see the photo "logo.png", and it returns a 404 error... It is clearly in the web root directory, but it is not served. Even so, I can still access the OLD photo "test.png" via URL, even though no such file is present on the server.
What I have tried:
I understand that this issue is certainly related, in some way, to caching, and I have tried many solutions on the web in my search, and none seemed to have any effect at all on my system.
I see also that in many cases, this situation can be caused by VirtualBox or something called Vagrant VM. My machine has never had either of these things run on it, and my server is running on a physical PC under my desk.
I thought that the issue could have been caused by my running of over 100 updates, as I hadn't run my server in a while, so I went so far as to back up my personal data and web data from the server and reinstall the operating system to the latest version, and reinstall software from there.
I just finished doing that, and reconfiguring all of the web software, but surely enough, it is still having the same issue.
The only things that I installed on the machine after doing a fresh reinstallation of the operating system are:
- openssh-server
- samba
- nginx
- mysql-server
- php-fpm
- php-mysql
I have read that this could be solved by setting sendfile in the nginx.conf file to off, but this didn't resolve anything.
My nginx.conf file and php.ini file are both default.
nginx.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# 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;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# 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/*;
}
Site Configuration:
server {
listen 80;
root /usr/share/nginx/vanilla/;
index index.html index.php index.htm;
server_name www.website.com website.com;
keepalive_timeout 10000;
client_max_body_size 1024M;
location / {
try_files $uri $uri/ =404;
#try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}