主机知识库
分享服务器知识

nginx服务器反向代理目录代理、页面代理

1、全站代理


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

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

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

3、目录代理配置

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

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

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

#指定文件类型代理配置(.shtml、.htm 类型文件代理 www.866877.com)
        location ~ .*\.(shtml|htm)$ {
        proxy_pass http://www.866877.com
        }
赞(0)
文章名称:《nginx服务器反向代理目录代理、页面代理》
文章链接:https://www.cmy.cn/host/1032.html
版权声明:茶猫云所有发布的内容,部分为原创文章,转载请注明来源!网络转载文章如有侵权请联系我们解决!
最新优惠:茶猫云VPS服务器