Error on Setup nginx to multiples ReactJS app on the same server?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I'm building an 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 projects.
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
The problem is when access http://application-domain/admin, for example, the aplication 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 ?
nginx webserver
add a comment |Â
up vote
1
down vote
favorite
I'm building an 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 projects.
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
The problem is when access http://application-domain/admin, for example, the aplication 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 ?
nginx webserver
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm building an 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 projects.
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
The problem is when access http://application-domain/admin, for example, the aplication 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 ?
nginx webserver
I'm building an 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 projects.
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
The problem is when access http://application-domain/admin, for example, the aplication 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 ?
nginx webserver
nginx webserver
asked Aug 26 at 14:10
DBs
61
61
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
I think what you are trying to accomplish can be done by expanding the root section of each location like this:
location /admin
root /var/www/admin;
location /dashboard
root /var/www/dashboard;
location /sales
root /var/www/sales;
But that would be the same as only having
location /
root /var/www/
Since a call to http://application-domain/admin
would evaluate to /var/www/admin
.
The first solution would hide anything else in /var/www/
as there is no location rule to access say http://application-domain/private
.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I think what you are trying to accomplish can be done by expanding the root section of each location like this:
location /admin
root /var/www/admin;
location /dashboard
root /var/www/dashboard;
location /sales
root /var/www/sales;
But that would be the same as only having
location /
root /var/www/
Since a call to http://application-domain/admin
would evaluate to /var/www/admin
.
The first solution would hide anything else in /var/www/
as there is no location rule to access say http://application-domain/private
.
add a comment |Â
up vote
0
down vote
I think what you are trying to accomplish can be done by expanding the root section of each location like this:
location /admin
root /var/www/admin;
location /dashboard
root /var/www/dashboard;
location /sales
root /var/www/sales;
But that would be the same as only having
location /
root /var/www/
Since a call to http://application-domain/admin
would evaluate to /var/www/admin
.
The first solution would hide anything else in /var/www/
as there is no location rule to access say http://application-domain/private
.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I think what you are trying to accomplish can be done by expanding the root section of each location like this:
location /admin
root /var/www/admin;
location /dashboard
root /var/www/dashboard;
location /sales
root /var/www/sales;
But that would be the same as only having
location /
root /var/www/
Since a call to http://application-domain/admin
would evaluate to /var/www/admin
.
The first solution would hide anything else in /var/www/
as there is no location rule to access say http://application-domain/private
.
I think what you are trying to accomplish can be done by expanding the root section of each location like this:
location /admin
root /var/www/admin;
location /dashboard
root /var/www/dashboard;
location /sales
root /var/www/sales;
But that would be the same as only having
location /
root /var/www/
Since a call to http://application-domain/admin
would evaluate to /var/www/admin
.
The first solution would hide anything else in /var/www/
as there is no location rule to access say http://application-domain/private
.
answered Aug 26 at 20:55
linux_pangolin
764
764
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f464925%2ferror-on-setup-nginx-to-multiples-reactjs-app-on-the-same-server%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password