I have two angular app's published to two different subfolders "testapp1" and "testapp2".
url's -
https://dev.testurl.org/foo -- For testapp1
https://dev.testurl.org/bar -- For testapp2
So i build angular with basehref
For testapp1:
ng build --prod --base-href /foo/
For testapp2:
ng build --prod --base-href /bar/
My nginx configuration,
server {
listen 80 default_server;
listen [::]:80 default_server;
client_max_body_size 1000M;
server_name dev.testurl.org localhost;
location /testapp1/ {
autoindex on;
root /testapp1/dist;
try_files $uri $uri/ /foo/index.html;
}
location /testapp2/ {
autoindex on;
root /testapp2/dist;
try_files $uri $uri/ /bar/index.html;
}
When i try to hit, https://dev.testurl.org/foo or /bar - it has console error says "Unexpected Syntax Error" basically it's not loading the correct sources. Any idea? whether i am building app correctly or doing something wrong nginx configuration?
fooandbarin your question, buttestapp1andtestapp2in your configuration file?/foo/index.htmlis actually located on the server at/testapp1/dist/index.html?