Eu tentei isso e funciona:
server {
listen 80;
listen [::]:80;
index index.html index.htm home home.html;
# Make site accessible from http://localhost/
server_name apphost.comp.ill.com;
location /app1 {
# we need to use alias here to strip the "app1" from
# the requested path
alias /var/www/apphost.comp.ill.com/app1/home;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location /app2 {
# we don't need an alias here because app2 matches the
# directory structure
root /var/www/apphost.comp.ill.com/;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
}
Eu recomendaria / app1 e / app2 sem uma barra inicial porque no meu teste a navegação para ... / app1 não funcionava de outra forma.
Documentação do comando alias: link