I'm trying to add a react app that will be displaying at mydomain.com/react-app. I'm pretty new to nginx and this is my first go at hosting a site on a Linux server. The site mydomain.com has existed on this server for some time and I built another part of the site using react and would like to host it at /react-app. This is my /etc/nginx/sites-available/react-app:
mydomain.com/react-app
mydomain.com
/react-app
/etc/nginx/sites-available/react-app
server { listen 80; server_name 0.0.0.0; location /react-app { alias /var/www/react-app/build/; index index.html; try_files $uri $uri/ /build/index.html; } }
I'm able to serve and visit the site at the IP location 0.0.0.0/react-app but not mydomain.com/react-app. I just get a 404 nginx error when I visit that address.
0.0.0.0/react-app
If your server app running for example on port 3500:
server { listen 80; listen [::]:80; server_name mydomain.com/ www.mydomain.com/; location / { proxy_pass http://localhost:3500; } }
2.1m questions
2.1m answers
60 comments
57.0k users