nginx反向代理使用substitutions4nginx替换内容

本文编写于3418天前,最后编辑于 3418天前,部分内容可能已经过时,请您自行斟酌确认。

需要重新编译一下nginx

git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --add-module=/root/ngx_http_substitutions_filter_module
make

mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
cp objs/nginx /usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -t
make upgrade

反向代理1024配置

server{
    listen 80;
    server_name t66y.aenes.com;
    rewrite ^(.*) https://t66y.aenes.com$1 permanent;
    }
server{
    listen 443;
    server_name t66y.aenes.com;

    ssl on;
    ssl_certificate /root/t66y/t66y.crt;
    ssl_certificate_key /root/t66y/t66y.key;
    ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ALL:-ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP;

    location /{
    rewrite https://t66y.aenes.com https://t66y.aenes.com/index.php;
    proxy_redirect off;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header User-Agent $http_user_agent;
    proxy_set_header Host "t66y.com";
    proxy_set_header Referer https://t66y.aenes.com;
    proxy_pass http://t66y.com;
    proxy_set_header Accept-Encoding "";
    subs_filter 't66y.com' 't66y.aenes.com';
    subs_filter 'http://173.236.54.236' 'https://t66y.aenes.com/css';
    subs_filter '<div class="tips" style="width:auto">' '<div class="tips" style="display:none;">';
        }
    location /css {
    proxy_pass http://173.236.54.236/;
    }
    }

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注