A little more elaborate example.
Setup: You have a website at example.com
and you have a web app at example.com/webapp
...
server {
listen 443 ssl;
server_name example.com;
root /usr/share/nginx/html/website_dir;
index index.html index.htm;
try_files $uri $uri/ /index.html;
location /webapp/ {
alias /usr/share/nginx/html/webapp_dir/;
index index.html index.htm;
try_files $uri $uri/ /webapp/index.html;
}
}
...
I've named webapp_dir
and website_dir
on purpose. If you have matching names and folders you can use the root
directive.
This setup works and is tested with Docker.
NB!!! Be careful with the slashes. Put them exactly as in the example.