I have hosted react app on nginx, when i try to access any file with extension (e.g favicon.ico), nginx throws 403 forbidden error although it works fine for basic app routing i.e, for files without extension. I'm pasting nginx config below, and the static files that i'm trying to access is in the /var/www/deebaco.com/html. Do i need to write another location block to serve files with extensions?
server {
listen 80;
server_name deebaco.com www.deebaco.com;
return 301 https://www.deebaco.com$request_uri;
}
server {
listen 443 ssl;
server_name deebaco.com;
ssl_certificate /root/deebaco.com.chained.crt;
ssl_certificate_key /root/deebaco.com.key;
return 301 https://www.deebaco.com$request_uri;
}
server {
listen 443 ssl http2;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
server_name www.deebaco.com;
root /var/www/deebaco.com/html;
ssl_certificate /root/deebaco.com.chained.crt;
ssl_certificate_key /root/deebaco.com.key;
#location / {
#try_files $uri $uri/ /index.html?$args;
#}
location / {
try_files $uri /index.html;
autoindex on;
autoindex_exact_size off;
}
}