I'd like to divert off requests to a particular sub-directory, to another root location. How? My existing block is:
server {
listen 80;
server_name www.domain.com;
location / {
root /home/me/Documents/site1;
index index.html;
}
location /petproject {
root /home/me/pet-Project/website;
index index.html;
rewrite ^/petproject(.*)$ /$1;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
} }
That is, http://www.domain.com should serve /home/me/Documents/site1/index.html whereas http://www.domain.com/petproject should serve /home/me/pet-Project/website/index.html -- it seems that nginx re-runs all the rules after the replacement, and http://www.domain.com/petproject just serves /home/me/Documents/site1/index.html .