Sample Header Ad - 728x90

Error on Setup nginx to multiples ReactJS app on the same server?

3 votes
1 answer
2018 views
I'm building a solution with multiple modules. Each module is a ReactJS app, and I trying config nginx to publish it on the same domain. For examples: - http://application-domain/**auth** - http://application-domain/**admin** - http://application-domain/**dashboard** - http://application-domain/**sales** My public directory for nginx stay like this:
/var/www
├── /auth
├── /admin
├── /dashboard
└── /sales
Where auth, admin, dashboard, and sales are subfolders for each project. My nginx server conf: server { listen 9000 default_server; listen [::]:9000 default_server; server_name localhost; index index.html; location / { root /var/www/auth; } location /admin { root /var/www; } location /dashboard { root /var/www; } location /sales { root /var/www; } } Each project's subfolder has the similar structure like this enter image description here The problem is when access http://application-domain/admin , for example, the application try to load the static files on root instead subfolder project GET http://localhost:9000/static/js/main.6314dcaa.js net::ERR_ABORTED the correct would be get files on **admin** sub folder like this: GET http://localhost:9000/admin/static/js/main.6314dcaa.js What's the better approach to correct nginx configuration for this?
Asked by DBs (31 rep)
Aug 26, 2018, 02:10 PM
Last activity: Jul 20, 2025, 11:10 PM