天天看點

114-nginx 負載均衡springboot jar項目,包括jar裡的靜态資源

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    upstream noticeapp{
        server 127.0.0.1:9002;
        server 127.0.0.1:9003;
    }
    server {
        listen       9001;
        server_name  localhost;

		location / {
		    proxy_pass http://noticeapp;
		    proxy_set_header Host $host;
		    proxy_set_header X-Real-IP $remote_addr;
		    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location ~ .* {
            proxy_pass http://noticeapp;
            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;
        }
    }
}
           

繼續閱讀