nginx简单配置

#user  nobody;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    gzip  on;
	upstream beiwai_proxy {   
	    server 47.92.159.190:8080 weight=1 max_fails=2 fail_timeout=30s;   
	}
    server {
        listen       80;
        server_name  static.cnblog.com;
	location / {
	   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_set_header Upgrade $http_upgrade;  
	    proxy_set_header Connection "upgrade";
         client_max_body_size    102400m;
             proxy_pass http://beiwai_proxy;	
        }
	location ^~ /static/ {
            alias	E:/ftp_dir/;
        }
	location ^~ /audio/ {
            alias	E:/ftp_dir/audio/;
        }
    }
}
#proxy_set_header Upgrade $http_upgrade;   websocket
#proxy_set_header Connection "upgrade";    websocket
#proxy_set_header HOST $host;    静态资源路径问题
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    静态资源路径问题

 

posted on 2018-03-20 10:01  祥昊  阅读(145)  评论(0编辑  收藏  举报

导航