nginx反向代理到本地响应慢的解决方案

本地的nginx反向代理到本地的静态服务器,竟然慢的要死

server {
        listen       8888;
        server_name  localhost;
        root "E:\Project\scratch-flash\mkt";
        location / {
            index  index.html index.htm;
           autoindex  on;
        }
    }
server {
        listen  80;
        server_name  localhost;
        client_max_body_size 10M;
        location / {
            proxy_pass http://localhost:8080/;
            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 /mkt/ {
            proxy_pass http://localhost:8888/;
            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_connect_timeout 1;
            add_header 'Access-Control-Allow-Origin' '*';
        }
}

增加一个配置即可
proxy_connect_timeout

发表评论

[/0o0] [..^v^..] [0_0] [T.T] [=3-❤] [❤.❤] [^v^] [-.0] [!- -] [=x=] [→_→] [><] 更多 »
昵称

抢沙发~