I\'m serving multiple angular apps from the same server block in Nginx. So in order to let the user browse directly to certain custom
Hope this helps someone
Step 1 - Build all your projects
ng build --prod --base-href /project1/
ng build --prod --base-href /project2/
ng build --prod --base-href /project3/
Step 2 - Configure your nginx, note the change added in try_files section
server {
listen 80;
server_name website.com;
# project1
location / {
alias /home/hakim/project1/dist/;
try_files $uri/ /project1/index.html;
}
# project2
location /project2/ {
alias /home/hakim/project2/dist/;
try_files $uri/ /project2/index.html;
}
# project3
location /project3/ {
alias /home/hakim/project3/dist/;
try_files $uri/ /project3/index.html;
}
}
Step 3 - Reload nginx configuration
sudo service nginx reload