I want to deploy my react app's in nginx
under the same server, serving different html's for different locations, I have tried below configuration but it din't work for me
server {
listen 8080;
# root /usr/share/nginx/build-bms;
# Add index.php to the list if you are using PHP
server_name _;
location ^~ /portal1/ {
root PATH_TO_BUILD_FOLDER_ONE;
try_files $uri /index.html;
index invalid;
add_header Cache-Control public;
expires 1d;
autoindex on;
}
location ^~ /portal2/ {
root PATH_TO_BUILD_FOLDER_TWO;
try_files $uri /index.html;
add_header Cache-Control public;
index invalid;
expires 1d;
break;
autoindex on;
}
location / {
root PATH_TO_BUILD_FOLDER_THREE;
try_files $uri /index.html;
add_header Cache-Control public;
expires 1d;
}
}
Every time only the last one is served