首頁  >  問答  >  主體

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 天前575

全部回覆(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
  • 取消回覆