请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

nginx 做gitbook的代理,报错,curl请求有返回值,请老师帮忙看一下不胜感激

请求地址 http://172.30.7.12/docs/qhd/ 报错
gitbook服务配置: http://172.30.7.12:4003/

错误信息:
2019/07/08 05:09:47 [error] 5#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 10.19.92.28, server: localhost, request: "GET /docs/qhd/ HTTP/1.1", upstream: "http://127.0.0.1:4003/", host: "172.30.7.12"

服务器中nginx.conf 配置
location /docs/qhd/ { proxy_pass http://127.0.0.1:4003/; allow all; }

服务其中curl测试,有返回值:
curl http://127.0.0.1:4003/

正在回答 回答被采纳积分+3

1回答

Jeson 2019-07-09 08:27:27

1、服务其中curl测试,有返回值:
curl http://127.0.0.1:4003/

这个是在哪台服务器上测试的结果?贴出下完整的Nginx配置,我看看

2、把这个配置allow all;去掉,然后再测试一下。


0 回复 有任何疑惑可以回复我~
  • 提问者 Hubery_Fight #1
    worker_processes  1;
    events {
        worker_connections  1024;
    }
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        #gzip  on;
        server {
            listen       80;
            server_name  localhost;
    
            location / {
                root   html;
                index  index.html index.htm;
            }
            location /update/ {
                proxy_pass http://127.0.0.1/jar/;
                auth_basic "请输入账户密码";
                auth_basic_user_file /work/tengine/auth/nginx/passwd.db;
                allow all;
                autoindex on;
                autoindex_exact_size off;
                autoindex_localtime on;
            }
            location /jar/ {
                root   html;
                autoindex on;
                autoindex_exact_size off;
                autoindex_localtime on;
            }
            location /docs/qhd/ {
                proxy_pass http://localhost:4003/;
                proxy_set_header  Host $host;
                proxy_buffering   off;
            }
            error_page  404              /404.html;
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
        }
    }
    回复 有任何疑惑可以回复我~ 2019-07-09 09:29:47
  • 提问者 Hubery_Fight #2
    curl 那个是运行在我nginx 运行的服务上测试的,172.30.7.12
    回复 有任何疑惑可以回复我~ 2019-07-09 09:31:05
  • 提问者 Hubery_Fight #3
    allow all;去掉后,测试也不好用。
    回复 有任何疑惑可以回复我~ 2019-07-09 09:55:42
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号