nginx反向代理设置

1. 同域名

server { 
listen 80; 
server_name dd.ylx.me;
#include /etc/nginx/conf/ddos2.conf;

location / {
	#设置主机头和客户端真实地址,以便服务器获取客户端真实IP
	proxy_set_header Host $host;	
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	#禁用缓存
	proxy_buffering off;
	#设置反向代理的地址,更换你的后端IP
	proxy_pass http://203.114.74.45;
      }
access_log off; 
} 

2.不同域名,不带缓存目录

server { 
listen 80; 
server_name windowsupdate.chuyu.me download.windowsupdate.chuyuroot.eastal.com;
#include /etc/nginx/conf/ddos2.conf;

location / {
		proxy_pass          http://wsus.ds.download.windowsupdate.com/;
        proxy_redirect      off;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_cache_valid  200 304 3h;
		proxy_cache_valid 301 6h;
		proxy_cache_valid any 10s;
}
access_log off; 
} 

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据