Reputation: 189
I am trying to configure Nginx (over debian 10) to serve two fronts (npm run build) of react.
All works fine on the first app "/", but not on "/administracion/" This is the configuration that I am using, and when I access I receive a 403. It does not seem like a permission problem, because it does not matter what I load, I always receive 403.
server {
listen 80;
server_name x.net;
root /var/www/html/front_web/build;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /administracion/ {
alias /var/www/html/front_admin/build;
try_files $uri $uri/ /index.html;
}
}
The App is created with react-router (I think this does not affect anything).
Upvotes: 1
Views: 355
Reputation: 26909
Are you using any routing libraries? If this is a CRA app, try setting the homepage property. Otherwise all your JS and assets will try to be served from root.
Upvotes: 3