server {
root /home/user/public_html;
location /app {
root /usr/share; # This results in /usr/share/app
# Full URI is ALWAYS appended.
}
location /app2 {
// Server context root applies here.
}
}
server {
access_log /var/log/nginx/access.log;
include fastcgi.conf;
location ~ ^/calendar/.+\.php$ {
access_log /var/log/nginx/php-requests.log; # If this executes then server context one never does.
fastcgi_param ENV debug; # This *overwrites* the higher context array.
include fastcgi.conf # Therefore we include it in *this* context again.
}
}
server {
rewrite ^/booking(.*) /calendar$1 permanent; # Always executes.
location /calendar {
rewrite ^ /index.php; # Can execute in addition to and does not replace server context rewrites.
}
}
server {
try_files $uri /index.php; # This never executes.
location / {
# Whatever here, or empty.
}
location ~ \.php$ {
# If this location executes then try_files still does not execute.
# Even if location / did not exist.
}
}