Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
Nginx set root to subfolder

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
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!