http redirect – Nginx does not direct – Stack Overflow
It looks like your Nginx configuration appears to be correct. However, there could be several reasons why it’s not directing to the index.html in the /root/patentwriter/static directory. Here are some troubleshooting steps:
File Permissions: Ensure that the Nginx user (usually www-data or nginx) has read access to the files in the /root/patentwriter/static directory.
sudo chown -R www-data:www-data /root/patentwriter/static
Check Server Blocks: Make sure that your /etc/nginx/sites-enabled directory contains only the patentpath.io configuration file. You mentioned you deleted the default file, which is a good step.
sudo rm /etc/nginx/sites-enabled/default
Server Name: Verify that the domain name in your server block matches the one you’re using in your browser. Make sure there are no typos.
Nginx Reload: After making changes, restart or reload Nginx to apply the new configuration.
sudo systemctl restart nginx
Browser Cache: Sometimes, the browser cache can cause issues. Try clearing your browser cache or testing in an incognito or private browsing window.
Error Log: Check Nginx error logs for any issues that might be preventing the correct file from being served:
sudo tail -f /var/log/nginx/error.log
This will show any errors in real-time as you access the site.
Default File: Ensure that there are no other configuration files in /etc/nginx/conf.d/ or elsewhere that might interfere with this server block. The sites-enabled configuration should take precedence.
Firewall: If you have a firewall (e.g., UFW), make sure that it’s not blocking incoming traffic on port 80.
SELinux or AppArmor: On some systems, security modules like SELinux or AppArmor can affect Nginx. Check if there are any denials in their logs.
Read more here: Source link
