Home  >  Q&A  >  body text

url-rewrite - How to set nginx to access xxx.com equal to xxx.com/html/web, and keep the domain name unchanged?

How to set nginx to access xxx.com equal to xxx.com/html/web, and keep the domain name unchanged?

When you visit xxx.com, you actually visit xxx.com/html/web
The url of the browser is still xxx.com
Is this possible?
How to configure
Thanks for the advice~~

PHPzPHPz2712 days ago565

reply all(1)I'll reply

  • 为情所困

    为情所困2017-05-16 17:26:26

    If it is a static or cgi website, it may be better to use try_files.

    root /path/to/root;
    index index.html index.html index.php;
    
    location / {
        try_files /html/web/$uri /html/web/$uri/ $uri $uri/ =404;
    }
    

    reply
    0
  • Cancelreply