解决 Nginx 代理慢的问题

前不久用 Nginx 代理 Oracle 的 Apex 速度非常慢,我之前Nginx 配置如下:

server{
        listen 80;
        server_name localhost;
        client_max_body_size 100M;
        location / {
                root html;
                index index.html;
        }
        #代理Apex
        location /apex/ {

                proxy_pass http://localhost:8080/apex/;

        }
}

 在漫长的查找中找到最靠谱的方法,就是把localhost 改成IP地址 127.0.0.1

proxy_pass http://localhost:8080/apex/;改成 proxy_pass http://127.0.0.1:8080:/apex/;  

#完整代码
server{
        listen 80;
        server_name localhost;
        client_max_body_size 100M;
        location / {
                root html;
                index index.html;
        }
        #代理Apex
        location /apex/ {
                proxy_pass http://127.0.0.1:8080/apex/;

        }
}

  

猜你喜欢

转载自www.cnblogs.com/ser0632/p/10979400.html