乐趣区

关于java:113nginx-负载均衡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;
        }
    }
}
退出移动版