AiHaoZ知识库

全网最全的知识库

Nginx服务器反向代理目录代理、页面代理配置规则

1、全站代理

复制
         #如果是宝塔,只需要下面这段
        location / {
            index  index.html index.htm index.php;
            #autoindex  on;
            #反向代理配置
            proxy_pass http://www.a.com
        }

2、全站代理配置(首页不代理)

复制
location = / {
        index index.html index.htm index.php
        }
        location / {
            index  index.html index.htm index.php;
            #autoindex  on;
            #反向代理配置
            proxy_pass http://www.a.com
        }

3、目录代理配置

之前有一篇文章说过,可以参考:https://www.cmy.cn/host/356.html

复制
#host目录代理显示a.com内容location /host/ {
        proxy_pass http://www.a.com
        }

4、指定类型文件代理配置

复制
#指定文件类型代理配置(.shtml、.htm 类型文件代理 www.a.com)
        location ~ .*\.(shtml|htm)$ {
        proxy_pass http://www.a.com
        }

海外购机就上触摸云CMZI.com

Copyright Your WebSite.Some Rights Reserved.