nginx 多个项目名称一个域名配置

user  root;
worker_processes  10;

error_log  /usr/local/nginx/logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  102400;
}

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;
	#post_entry_max_size
	client_max_body_size 200m;
    	#keepalive_timeout  0;
    	keepalive_timeout  15s;

    	gzip  on; 
	gzip_http_version 1.0;
	gzip_comp_level 7;
	gzip_proxied any;
	gzip_min_length 100;
	gzip_buffers 16 8k;
	gzip_types text/plain text/css application/x-javascript application/javascript text/xml application/xml application/xml+rss text/javascript image/jpeg image/gif image/png;
	# Some version of IE 6 don't handle compression well on some mime-types,
	# so just disable for them
	gzip_disable "MSIE [1-6].(?!.*SV1)";
	# Set a vary header so downstream proxies don't send cached gzipped
	# content to IE6
	gzip_vary on;
	#end gzip	

	#cache begin
	proxy_buffering on;
	proxy_cache_valid any 10m;
	proxy_cache_path /usr/local/nginx/proxy_cache levels=1:2 keys_zone=my-cache:8m max_size=1000m inactive=600m;
	proxy_temp_path /home/temp;
	proxy_buffer_size 4k;
	proxy_buffers 100 8k;
	#cache end	


 	#https server设置实际操作
	server {
    		listen       80;
    		server_name  wechat.zhenghan.com;
    		charset utf-8;
    		access_log  logs/host.access.log  main;

		location /wxqyh/ {
			proxy_pass http://127.0.0.1:8282/wxqyh/;
                        proxy_set_header X-Real-IP $remote_addr;
               	        proxy_set_header Host $host;
               	        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                        proxy_http_version 1.1;
                        proxy_set_header Upgrade $http_upgrade;
                        proxy_set_header Connection "upgrade";
                        rewrite /wss/(.*) /$1 break;
                        proxy_redirect off;
                        proxy_connect_timeout 4s;
                        proxy_read_timeout 7200s;
                        proxy_send_timeout 12s;

		}
		location /admin/ {
        		proxy_pass http://127.0.0.1:8181/admin/;
        		proxy_set_header Host $http_host;
        		proxy_set_header X-Real-IP $remote_addr;
        		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
				#add_header Access-Control-Allow-Origin *;
		}
		location /fileweb/ {
        		proxy_pass http://127.0.0.1:6099/fileweb/;
        		proxy_set_header Host $http_host;
        		proxy_set_header X-Real-IP $remote_addr;
        		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
				#add_header Access-Control-Allow-Origin *;
		}
    		#error_page  404              /404.html;
    		#redirect server error pages to the static page /50x.html
    		#error_page   500 502 503 504  /50x.html;
    		location = /50x.html {
        		root   html;
    		}
	}
}

 

你可能感兴趣的:(nginx)