nginx location outside document root -


i new nginx. please me set following configuration: root folder site.com /var/www(root /var/www). when opens http://site.com, want load contents /var/www/home. if tries http://site.com/anything, want load contents /var/www/anything.

i tried following

root /var/www; location = / { root /var/www/home } 

but didn't work.

also, tried

location = / { root /var/www/home }  location / { root /var/www } 

and again didn't work,

please help

try this:

location ~ ^/$ {     root /var/www/home; } location ~ ^(?!/$) {     root /var/www; } 

or this:

location / {     root /var/www;     rewrite ^/$ /home/ break; } 

Comments