我试图反向代理我的网站并修改内容.
为此,我使用sub_filter编译了Nginx.
它现在接受sub_filter指令,但它不能以某种方式工作.
server {
listen 8080;
server_name www.xxx.com;
access_log /var/log/Nginx/www.goparts.access.log main;
error_log /var/log/Nginx/www.goparts.error.log;
root /usr/share/Nginx/html;
index index.html index.htm;
## send request back to apache1 ##
location / {
sub_filter 502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
请帮我
最佳答案
检查上游源是否已打开gzip,如果需要,请执行此操作
原文链接:https://www.f2er.com/nginx/435288.htmlproxy_set_header Accept-Encoding "";
所以整个事情都会像
location / {
proxy_set_header Accept-Encoding "";
proxy_pass http://upstream.site/;
sub_filter_types text/css;
sub_filter_once off;
sub_filter .upstream.site special.our.domain;
}
检查这些链接
> https://www.ruby-forum.com/topic/178781
> https://forum.nginx.org/read.php?2,226323
> http://www.serverphorums.com/read.php?5,542078