Answer the question
In order to leave comments, you need to log in
How to specify in the config for an alternative route - alternative html?
I want to make it so that when I log in from a browser via https://0.0.0.0 , "location /" works,
and when I log in via https://0.0.0.0/site2 , "location /site2" works,
but for some reason it always works " location /".
Both sites are on React, but it hardly matters
nginx.conf snippet:
server {
listen 80;
server_name ipaddr;
location = /favicon.ico {
alias /home/siteadmin/site1/favicon.ico;
}
location / {
root /home/siteadmin/site1;
try_files $uri $uri/ /index.html;
}
location = /site2 {
root /home/siteadmin/site2;
index index.html;
try_files $uri $uri/ /index.html;
}
}
Answer the question
In order to leave comments, you need to log in
Understood.
In fact, the path is a little longer than I indicated in the message, I decided to simplify and in vain.
Path: /home/siteadmin/site2/client/index.html
So the code worked:
location /client {
root /home/siteadmin/site2;
index index.html;
try_files $uri $uri/ /client/index.html;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question