[英]503 Service Temporarily Unavailable with gitlab docker and nginx-proxy docker
[英]503 Service Temporarily Unavailable nginx/1.13.3 in docker
我正在嘗試使用jwilder/nginx-proxy: alpine
來啟動nginx
,以下是docker run命令和步驟:
步驟1 : docker run -d -p 80:80 -p 443:443 -v /var/run/docker.sock:/tmp/docker.sock:ro --name nginx jwilder/nginx-proxy:alpine
步驟2 :在ec2實例的安全組中打開端口80
,並嘗試連接到ip:80/
,但錯誤如下所示503服務暫時不可用nginx / 1.13.3
碼頭工人日志說:
WARNING: /etc/nginx/dhparam/dhparam.pem was not found. A pre-generated dhparam.pem will be used for now while a new one
is being generated in the background. Once the new dhparam.pem is in place, nginx will be reloaded.
forego | starting dockergen.1 on port 5000
Generating DH parameters, 2048 bit long safe prime, generator 2
forego | starting nginx.1 on port 5100
dockergen.1 | 2017/08/14 13:45:44 Generated '/etc/nginx/conf.d/default.conf' from 4 containers
dockergen.1 | 2017/08/14 13:45:44 Running 'nginx -s reload'
dockergen.1 | 2017/08/14 13:45:44 Watching docker events
dockergen.1 | 2017/08/14 13:45:44 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
nginx.1 | ec2-xx.xx.xxx.xx..ap-xyz-5.compute.amazonaws.com xx.xxx.xxx.x - "GET / HTTP/1.1" 503 615 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36"
nginx.1 | ec2-xx.xxx.xxxx.xxx.ap-xyz-5.compute.amazonaws.com xx.xx.xx.xxx "GET /favicon.ico HTTP/1.1" 503 615 "http://ec2-xx.xxx.xx.xx.ap-xyz-5.compute.amazonaws.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36"
jwilder/nginx-proxy
並沒有多大意義。 魔術背后的腳本檢查其他容器的環境變量,並生成相應的規則,以從hostname from another container as defined in env var : port defined the same way
反向代理,以與上述容器和端口hostname from another container as defined in env var : port defined the same way
。
此處的鍵是“來自另一個容器的主機名”。 當您嘗試使用您所說的IP連接時,Nginx不會代理轉發您。
這是jwielder / nginx的README.md的github存儲庫中的示例
version: '2'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
whoami:
image: jwilder/whoami
environment:
- VIRTUAL_HOST=whoami.local <================
運行此命令,編輯您的主機文件(類似於sudo vim /etc/hosts
),添加[ec2ip] whoami.local
然后打開瀏覽器訪問http://whoami.local ,就可以了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.