2016/04/28 18:51:15 [error] 8#8: *1 connect() Failed (111: Connection refused) while connecting to upstream,...
我通过这个命令安装docker-Nginx:
sudo docker pull Nginx
我的docker命令行是这样的(为了清除我添加一些缩进):
sudo docker run --name docker-Nginx -p 80:80 -v ~/docker-Nginx/default.conf:/etc/Nginx/conf.d/default.conf -v /usr/share/Nginx/HTML:/usr/share/Nginx/HTML Nginx
我在我的家庭目录中创建了一个文件夹名称’docker-Nginx’,将我的Nginx conf文件移到此文件夹中,然后在etc / Nginx目录中删除我原来的conf以防万一.
我的Nginx conf文件如下所示:
server { Listen 80 default_server; # Listen [::]:80 default_server ipv6only=on; root /usr/share/Nginx/HTML; index index.HTML index.htm; # Make site accessible from http://localhost/ server_name localhost; location / { proxy_pass http://127.0.0.1:3838/; proxy_redirect http://127.0.0.1:3838/ $scheme://$host/; auth_basic "Username and Password are required"; auth_basic_user_file /etc/Nginx/.htpasswd; # enhance the performance proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; }}解决方法 您必须直接定义上游.目前,您的Nginx无法代理您的Web应用程序.
http://nginx.org/en/docs/http/ngx_http_upstream_module.html
upstream backend { server backend1.example.com weight=5; server backend2.example.com:8080; server unix:/tmp/backend3; server backup1.example.com:8080 backup; server backup2.example.com:8080 backup;}server { location / { proxy_pass http://backend; }}总结
以上是内存溢出为你收集整理的web-services – docker nginx连接在连接到上游时被拒绝全部内容,希望文章能够帮你解决web-services – docker nginx连接在连接到上游时被拒绝所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)