首页  >  问答  >  正文

url-rewrite - nginx如何设置访问xxx.com等同于xxx.com/html/web,并且域名不变呢?

nginx如何设置访问xxx.com等同于xxx.com/html/web,并且域名不变呢?

访问xxx.com 其实是访问到的是xxx.com/html/web
而浏览器的url还是xxx.com
这样可以做到么
如何配置
谢谢指点~~

PHPzPHPz2713 天前568

全部回复(1)我来回复

  • 为情所困

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

    假如是一个静态或 cgi 方式的网站,用 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;
    }
    

    回复
    0
  • 取消回复