I have just encountered a very weird issue. Some of the fonts that I have used in my website and an svg are not loading, while yesterday everything was working fine. The only changes that I've recently made, are some rewrites to remove the extension.
Every path is correct, and the main nginx.conf
file contains include /etc/nginx/mime.types;
Again, everything was working fine yesterday.
This is my configuration file, which is the only thing that I changed.
server {
listen 80;
listen [::]:80;
server_name mysite.app;
rewrite ^(/.*)\.html(\?.*)?$ $1$2 permanent;
rewrite ^/(.*)/$ /$1 permanent;
root /var/www/html/;
index index.php index.html index.htm index.nginx-debian.html;
location / {
#try_files $uri $uri.html $uri/ @extensionless-php;
try_files $uri/index.html $uri.html $uri/ @extensionless-php;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
location ~* \.(pdf)$ {
expires 30d;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
if ($request_uri ~ ^/([^?]*)\.php$) {
return 307 /$1;
}
if ($request_uri ~ ^/([^?]*)\.php(\?+)) {
return 302 /$1?$args;
}
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
location ~ /\.ht {
deny all;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mysite.app/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mysite.app/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
listen 443 ssl http2; # managed by Certbot
server_name www.mysite.app;
ssl_certificate /etc/letsencrypt/live/mysite.app/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mysite.app/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
return 301 https://mysite.app$request_uri;
}
server {
if ($host = www.mysite.app) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80 ;
server_name www.mysite.app;
return 404; # managed by Certbot
}
Running curl -IL <resource_location>
I am getting a HTTP/1.1 404 Not Found
error.