Skip to content

React app on nginx – only homepage loading and subpages not loading error. – How to fix?

When you have deployed your react app using nginx and when you try to access the subpages in your app, it might return 404 at the first instance. To fix this error, please change this line on your-domain nginx conf.

vi /etc/nginx/sites-enabled/your-domain

Change this to..

  location / {
		try_files $uri $uri/ =404;


  location / {
		try_files $uri /index.html;

Thank me later.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.