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;

    #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  0;
    keepalive_timeout  65;

    #gzip  on;



	
	upstream aaa {
		#ip_hash;
		server  192.168.8.101:1000  weight=6;
		server  192.168.8.101:2000  weight=4;
		server  192.168.8.101:3000  down;
		server  192.168.8.101:3000  backup;
	}
	
	
	server {
        listen       8000;
        server_name  192.168.8.101;
		gzip on;
		gzip_buffers 32 4K;
		gzip_comp_level 6;
		gzip_min_length 100;
		gzip_types application/javascript text/css text/xml;
		gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
		gzip_vary on;
		root   D:\workProject\front\supplier-web\platform-web\dist;
		index index.html index.htm;
		
		location /supplier {
            alias   D:\workProject\front\supplier-web\supplier-web\dist;
            index  index.html index.htm;
        }
		
		location /center {
            alias   D:\workProject\front\supplier-web\centralized-web\dist;
            index  index.html index.htm;
        }
		
	
		location ^~ /api/ {
				proxy_pass http://192.168.8.101:9000/;   
				proxy_set_header Host $http_host; 
		}
		
		
		location / {
				client_max_body_size    100m;
				try_files $uri $uri/ index.html @index;
		}

		location @index {
				add_header Cache-Control no-cache;
				expires 0;
				try_files /index.html =404  index.html;
		} 


		
		
        error_page   500 502 503 504 =200  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
	

#	server {
#        listen       1000;
#        server_name  192.168.8.101;
#        location / {
#            root   D:\workProject\front\supplier-web\platform-web\dist;
#            index  index.html index.htm;
#        }
#    }
	
#	server {
#        listen       2000;
#        server_name  192.168.8.101;
#        location / {
#            root   D:\workProject\front\supplier-web\supplier-web\dist;
#            index  index.html index.htm;
#        }
#        error_page   500 502 503 504  /50x.html;
#        location = /50x.html {
#            root   html;
#        }
#    }

#	server {
#        listen       3000;
#        server_name  192.168.8.101;
#        location / {
#            root   D:\workProject\front\supplier-web\centralized-web\dist;
#            index  index.html index.htm;
#        }
#        error_page   500 502 503 504  /50x.html;
#        location = /50x.html {
#            root   html;
#        }
#    }

	server {
        listen       4000;
        server_name  192.168.8.101;
        location / {
            root   D:\workProject\front\supplier-web\supplier-wx-h5\dist\build\h5;
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
	

	
	 server {
        listen    8080;
        server_name  192.168.8.101;
		gzip on;
		gzip_buffers 32 4K;
		gzip_comp_level 6;
		gzip_min_length 100;
		gzip_types application/javascript text/css text/xml;
		gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
		gzip_vary on;
		root   D:\workProject\front\medical-consumables-website\dist\mc;
		index index.html index.htm;
			
		location ^~ /admin-center {
				alias   D:\workProject\front\medical-consumables-website\dist\system;
				index index.html index.htm;
				try_files $uri $uri/ index.html @index;
				#proxy_pass http://192.168.8.101:8083/;   
				#proxy_set_header Host $http_host; 
		}
			

		location ^~ /api/ {
				client_max_body_size    100m;
				proxy_pass http://192.168.8.101:8081/;   
				proxy_set_header Host $http_host; 
		}
		
	
		location / {
				client_max_body_size    100m;
				try_files $uri $uri/ index.html @index;
		}

		location @index {
				add_header Cache-Control no-cache;
				expires 0;
				try_files /index.html =404  index.html;
		} 



		location ^~ /minio/ {
				proxy_pass http://192.168.8.106:9000/;   
				proxy_set_header Host $http_host; 
		}
		
		location ^~ /demo/ {
				proxy_pass http://192.168.8.101:6868;   
				proxy_set_header Host $http_host; 
		}
		
		

    }
	
	
	server {
		listen       8083;
		server_name  192.168.8.101;
		gzip on;
		gzip_buffers 32 4K;
		gzip_comp_level 6;
		gzip_min_length 100;
		gzip_types application/javascript text/css text/xml;
		gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
		gzip_vary on;
		root   D:\workProject\front\medical-consumables-website\dist\system;
		index index.html index.htm;
    
		location ^~ /api/ {
				proxy_pass http://192.168.8.101:8081/;   
				proxy_set_header Host $http_host; 
				proxy_read_timeout 300;
		}

		location / {
				client_max_body_size    100m;
				try_files $uri $uri/ index.html @index;
		}
				
		location @index {
				add_header Cache-Control no-cache;
				expires 0;
				try_files /index.html =404;
		}       
    }
   
   
	
	
	
	server {
        listen    9010;
        server_name  192.168.8.101;
		gzip on;
		gzip_buffers 32 4K;
		gzip_comp_level 6;
		gzip_min_length 100;
		gzip_types application/javascript text/css text/xml;
		gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
		gzip_vary on;
		root   D:\workProject\front\material-wechat-group-h5\dist\build\h5;
		index index.html index.htm;
		
		location ^~ /api/ {
				client_max_body_size    100m;
				proxy_pass http://192.168.8.101:7000/;   
				proxy_set_header Host $http_host; 
		}
		
		
		location ^~ /WW_verify_sfhyyHZlQfkdAqDb.txt {
				client_max_body_size    100m;
				proxy_pass http://192.168.8.101:7000/mmcwx/WW_verify_sfhyyHZlQfkdAqDb.txt/;   
				proxy_set_header Host $http_host; 
		}
		
		
		location / {
				client_max_body_size    100m;
				try_files $uri $uri/ index.html @index;
		}

		location @index {
				add_header Cache-Control no-cache;
				expires 0;
				try_files /index.html =404  index.html;
		} 


    }
	
	
	
	
	server {
        listen    9090;
        server_name  192.168.8.101;
		add_header 'Access-Control-Allow-Methods' 'GET,OPTIONS,POST' always;
        add_header 'Access-Control-Allow-Credentials' 'true' always;
        add_header 'Access-Control-Allow-Origin' $http_origin always;
        add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With, Cache-Control' always;
        if ($request_method = OPTIONS ) { return 200; }
			
		location / {
			add_header 'Access-Control-Allow-Methods' 'GET,OPTIONS,POST' always;
            add_header 'Access-Control-Allow-Credentials' 'true' always;
            add_header 'Access-Control-Allow-Origin' $http_origin always;
            add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With, Cache-Control' always;
            if ($request_method = OPTIONS ) { return 200; }

			client_max_body_size    100m;
			proxy_pass http://192.168.8.101:8081/;   
			proxy_set_header Host $http_host; 
			proxy_read_timeout 300;
		}    

    }
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	server {
		listen 5000;
		server_name 192.168.8.101;
	    location / {
			proxy_redirect off ;
			proxy_set_header Host $host;
			proxy_set_header X-Real-IP $remote_addr;
			proxy_set_header REMOTE-HOST $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
			proxy_connect_timeout 600;
			proxy_send_timeout 600;
			proxy_read_timeout 600;
			proxy_buffer_size 1600k;
			proxy_buffers 4 3200k;
			proxy_busy_buffers_size 6400k;
			proxy_temp_file_write_size 6400k;
			proxy_max_temp_file_size 128m;
			proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
            proxy_pass http://aaa;
        }
	}

  
  
	#正向代理
	server {
		resolver 114.114.114.114;       #指定DNS服务器IP地址 
		listen 90;
		location / {
			proxy_pass http://$host$request_uri;     #设定代理服务器的协议和地址 
			proxy_set_header HOST $host;
			proxy_buffers 256 4k;
			proxy_max_temp_file_size 0k;
			proxy_connect_timeout 30;
			proxy_send_timeout 60;
			proxy_read_timeout 60;
			proxy_next_upstream error timeout invalid_header http_502;
		}
	}
	server {
		resolver 114.114.114.114;       #指定DNS服务器IP地址 
		listen 4433;
		location / {
		   proxy_pass https://$host$request_uri;    #设定代理服务器的协议和地址 
		   proxy_buffers 256 4k;
		   proxy_max_temp_file_size 0k;
		   proxy_connect_timeout 30;
		   proxy_send_timeout 60;
		   proxy_read_timeout 60;
		   proxy_next_upstream error timeout invalid_header http_502;
		}
	}
		
	

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值