您的位置:首页技术文章
文章详情页

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

浏览:86日期:2023-08-17 08:06:26

问题描述

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

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

问题解答

回答1:

假如是一个静态或 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;}

标签: HTML