请教一个nginx规则写法
假设网站域名是abc.comindex是index.html
我想达成如果直接访问abc.com则显示index.html的页面,如果后面有文件名,比如访问abc.com/xyz,则301到123.abc.com/xyz
有没有大佬帮下忙,可以不可以实现?
查无此人 发表于 2019-1-9 11:09
大佬 伪静态 路由规则什么的 哪里学 有视频资料吗 [*]
[*]nameserver abc.com
[*]location / {
[*] root /xx/x/xx/x
[*] index index.html
[*]}
[*]
[*]location /xyz/ {
[*] proxy_pass http://123.abc.com;
[*]}复制代码
022.gif
嗯,我也不知道是不是。 [*]rewrite ^/(.+)$ $scheme://123.abc.com/$1 permanent;复制代码
查无此人 发表于 2019-1-9 11:16
这个是反代
022.gif
大佬,这种方式可以实现么
查无此人 发表于 2019-1-9 11:09
大佬,不行啊。
rewrite ^/(^(index.html)+)$ http://123.abc.com permanent;
这种写法直接访问abc.com没问题,但是后面加上/xyz不会跳转。
页:
[1]