线上Linux服务器nginx反向代理配置文件 – 21运维
通知: .-...

线上Linux服务器nginx反向代理配置文件

nginx 21运维 1428浏览 0评论

线上的一个专用nginx反向代理服务器配置文件,每天千万级请求(域名已经过滤 ,通过www.proxydomain.com反代www.21yunwei.com):

user  nginx  nginx;
worker_processes  auto;
worker_rlimit_nofile 100000;
error_log  logs/error.log;
pid        logs/nginx.pid;

events {
    worker_connections  2048;
    multi_accept on; 
    use epoll;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;
    keepalive_timeout  50;

    gzip  on;
    proxy_cache_path /var/nginx/cache/one  levels=1:2   keys_zone=one:10m max_size=5g;
    proxy_cache_key "$host$request_uri";

    upstream server {
        server www.21yunwei.com:80;
    }
    server {
    listen 80;
    server_name www.proxydomain.com;
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
                     root      /wwwroot/images;  
                     expires      30d;
    }
    location / {
        proxy_cache one;
	
        #proxy_cache_valid  200 302 1s;
        proxy_cache_valid  404 1m;
        proxy_redirect http:/www.21yunwei.com/ /;
        proxy_cookie_domain 21yunwei.com proxydomain.com;
        proxy_pass http://server;
        proxy_set_header Host "www.21yunwei.com";
        proxy_set_header Accept-Encoding "";
        proxy_set_header User-Agent $http_user_agent;
        #proxy_set_header Accept-Language "zh-CN";
	proxy_set_header Referer $http_referer;
	proxy_set_header Cookie $http_cookie;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	#proxy_set_header X-Frame-Options ' ';
        sub_filter 'http://www.21yunwei.com'   'https://www.proxydomain.com';
	#sub_filter_last_modified  on;
        sub_filter_once on;
	sub_filter_types  *;
        } 
    }
}

转载请注明:21运维 » 线上Linux服务器nginx反向代理配置文件

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址