随着互联网的发展、许多网站都要求https,但是像api接口等,存在网站不升级https情况,这里就需要反代
反向代理其他域名
location / {
index index.html;
proxy_pass http://bl.7yue.pro$request_uri;
}
这里会出现错误 nginx no resolver defined to resolve..
解决办法
加入 resolver 指令。来指定dns服务器。
location / {
index index.html;
resolver 114.114.114.114;
proxy_pass http://bl.7yue.pro$request_uri;
}
通过substitutions4nginx模块,实现盗站
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server_tokens off;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable "MSIE [1-6]\.";
proxy_cache_path /home/zbs/jiajucache levels=1:2 keys_zone=jiaju:20m max_size=2g inactive=72h;
server {
listen 80;
server_name jiaju.ydjy365.com;
location / {
subs_filter 'jiaju.sg169.com' 'jiaju.ydjy365.com' gi;
proxy_set_header Host jiaju.sg169.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://jiaju.sg169.com;
proxy_set_header Accept-Encoding '';
proxy_pass http://jiaju.sg169.com;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 10d;
proxy_pass http://jiaju.sg169.com;
proxy_cache jiaju;
proxy_cache_valid 72h;
}
location ~ .*\.(js|css)$
{
expires 12h;
proxy_pass http://jiaju.sg169.com;
proxy_cache jiaju;
proxy_cache_valid 12h;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}