How do I configure my Nginx server to work with a React app in a subfolder?
The last component of the try_files
statement should be a URI. Assuming that your index.html
file is located under the /var/www/reactApp
subfolder, you should use:
location /reactApp { root /var/www; index index.html; try_files $uri $uri/ /reactApp/index.html;}
See this document for more.