I'm not using any frameworks or anything. I'm trying to place my style.css in the same directory as the index.html (which loads fine), but it throws a 500 error when I try to access it. So https://example.com/index.html loads fine (without styles), but accessing https://example.com/style.css throws a 500 Internal Server Error. Strangely enough it works if I put my stylesheets into a subdirectory,so https://example.com/styles/style.css loads fine.
This is my configuration for the site (virtual host):
server {
listen 80;
server_name example.com www.example.com;
location / {
return 301 https://$host$request_uri;
}
location /.well-known {
alias /usr/share/nginx/html/.well-known;
allow 0.0.0.0;
deny all;
}
}
server {
listen 443;
server_name example.com www.example.com;
root /home/deployer/example.com;
ssl on;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
include includes/ssl;
try_files $uri/index.html $uri;
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
Error.log
2017/01/13 06:25:46 [error] 1279#0: *182 rewrite or internal redirection cycle while internally redirecting to "/style.css", client: 0.0.0.0, server: example.com, request: "GET /style.css HTTP/1.1", host: "example.com"
2017/01/13 06:25:47 [error] 1279#0: *183 rewrite or internal redirection cycle while internally redirecting to "/favicon.ico", client: 0.0.0.0, server: example.com, request: "GET /favicon.ico HTTP/1.1", host: "example.com", referrer: "https://example.com/style.css"
Access.log
0.0.0.0 - - [13/Jan/2017:06:25:46 -0500] "GET /style.css HTTP/1.1" 500 603 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36"
0.0.0.0 - - [13/Jan/2017:06:25:47 -0500] "GET /favicon.ico HTTP/1.1" 500 603 "https://example.com/style.css" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36"