With Nginx, i need the download folder to become the home page of my website, while still allowing the terms.html page to appear at the root. The download folder displays the list of files with the fancyindex and fancyindex_header directives.
I did this: root /var/www/html/download;
but I no longer have access to pages outside the download folder like terms.html
does nginx allow this configuration? here is the structure of my directories:
www/
/download/ # fancyindex on + home page
/account/
/index.php
/login.php
/signup.php
/css/
/js/
robots.txt
terms.html
If your directory structure follows your URI structure, you should probably set the root
to /var/www/html
at the server
level and use /var/www/html/download
for one location
only.
For example:
server {
...
root /var/www/html;
location / {
root /var/www/html/download;
fancyindex on;
}
location /account/ {
... # PHP stuff
}
location /css/ { }
location /js/ { }
location = /robots.txt { }
location = /terms.html { }
The last four blocks can be empty, as they inherit the value of root
from the surrounding block. See this document for details.