乐云主机笔记

  • 首页
  • 主机优惠
  • 学习记录
  • 新手教程
  • 自用主机
  • 资源下载
  • 网赚项目
  • 其他
  • pingtest

  1. 首页
  2. 学习记录
  3. 正文

[最新测试]宝塔BT-PANEL下反代discuz论坛并实现登陆、发帖、管理功能

2019年10月27日 1225点热度 0人点赞 0条评论

直接贴出网站配置文件

其中www.fandaiyuming.com和fandaiyuming.com为反代域名

fandaiyuming.com通过301跳转www.fandaiyuming.com

yuanzhanyuming.com为源站域名

主要目的是自用主机实现网站加速效果

server
{
    listen 80;
    server_name www.fandaiyuming.com fandaiyuming.com;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/www.fandaiyuming.com;
    
    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
	#301-START
		if ($host ~ '^fandaiyuming.com'){
			return 301 http://www.fandaiyuming.com$request_uri;
		}
	#301-END
    #SSL-END
    
    #ERROR-PAGE-START  错误页配置,可以注释、删除或修改
    error_page 404 /404.html;
    error_page 502 /502.html;
    #ERROR-PAGE-END
    
    #PHP-INFO-START  PHP引用配置,可以注释或修改

	#PROXY-START
    location ~ /purge(/.*) { 
        proxy_cache_purge cache_one $host$request_uri$is_args$args;
        #access_log  /www/wwwlogs/www.fandaiyuming.com_purge_cache.log;
    }
    location / 
    {
        sub_filter_types *;
        sub_filter yuanzhanyuming.com www.fandaiyuming.com;
        sub_filter_once off;
        proxy_pass http://yuanzhanyuming.com;
        proxy_set_header Host yuanzhanyuming.com;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header REMOTE-HOST $remote_addr;
                
        #持久化连接相关配置
        #proxy_connect_timeout 30s;
        #proxy_read_timeout 86400s;
        #proxy_send_timeout 30s;
        #proxy_http_version 1.1;
        #proxy_set_header Upgrade $http_upgrade;
        #proxy_set_header Connection "upgrade";
        
        add_header X-Cache $upstream_cache_status;
        proxy_set_header Accept-Encoding "";
        expires 12h;
    }
    
    location ~ .*\.(php|jsp|cgi|asp|aspx|flv|swf|xml)?$
    {   
        sub_filter_types *;
        sub_filter yuanzhanyuming.com www.fandaiyuming.com;
        sub_filter_once off;
        proxy_set_header Host yuanzhanyuming.com;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Referer http://yuanzhanyuming.com;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_pass http://yuanzhanyuming.com;
        proxy_set_header Accept-Encoding "";
    }
    
    location ~ .*\.(html|htm|png|gif|jpeg|jpg|bmp|js|css)?$
    {
        proxy_set_header Host yuanzhanyuming.com;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       # proxy_set_header Referer http://yuanzhanyuming.com;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_pass http://yuanzhanyuming.com;
        
        #缓存相关配置
        sub_filter_types *;
        sub_filter yuanzhanyuming.com www.fandaiyuming.com;
        sub_filter_once off;
        #proxy_cache cache_one;
        #proxy_cache_key $host$request_uri$is_args$args;
        #proxy_cache_valid 200 304 301 302 1h;
        proxy_set_header Accept-Encoding "";
        expires 24h;
    }
    #PROXY-END

	include enable-php-00.conf;
    #PHP-INFO-END
    
    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/www.fandaiyuming.com.conf;
    #REWRITE-END
    
    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    
    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }
    
    access_log  /www/wwwlogs/www.fandaiyuming.com.log;
    error_log  /www/wwwlogs/www.fandaiyuming.com.error.log;
}

简化版如下

  location / {
    sub_filter_types *;
    sub_filter yuanzhan.com fandai.com;
    sub_filter_once off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Referer https://yuanzhan.com;
    proxy_set_header Host yuanzhan.com;
    proxy_pass https://yuanzhan.com;
    proxy_set_header Accept-Encoding "";
  }

yuanzhan.com 源站
fandai.com 反代

标签: 暂无
最后更新:2019年10月27日

letvps

这个人很懒,什么都没留下

打赏 点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

分类
  • 主机优惠
  • 其他
  • 域名优惠
  • 学习记录
  • 新手教程
  • 网赚项目
  • 脚本源码
  • 自用主机
  • 资源下载
书签
  • AdvinServers.com
  • 猫云云计算

COPYRIGHT © 2021 Letcloud.cn. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

粤ICP备15031609号-3