[英]503 Service Temporarily Unavailable nginx/1.13.3 in docker
I am trying to use jwilder/nginx-proxy: alpine
in order to start nginx
, following is the docker run command and steps: 我正在尝试使用
jwilder/nginx-proxy: alpine
来启动nginx
,以下是docker run命令和步骤:
Step1 : docker run -d -p 80:80 -p 443:443 -v /var/run/docker.sock:/tmp/docker.sock:ro --name nginx jwilder/nginx-proxy:alpine
步骤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
Step2 : Opened port 80
in the Security Group of ec2 instance, and trying to connect to ip:80/
, but the error is as follows 503 Service Temporarily Unavailable nginx/1.13.3 步骤2 :在ec2实例的安全组中打开端口
80
,并尝试连接到ip:80/
,但错误如下所示503服务暂时不可用nginx / 1.13.3
docker logs says: 码头工人日志说:
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
doesn't make a lot of sense ran alone. jwilder/nginx-proxy
并没有多大意义。 The script behind the magic check other containers environment variables and generate the according rules to reverse proxy from hostname from another container as defined in env var : port defined the same way
to the said container & port. 魔术背后的脚本检查其他容器的环境变量,并生成相应的规则,以从
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
。
The key here is "hostname from another container". 此处的键是“来自另一个容器的主机名”。 Nginx won't proxy-forward you when you're trying to connect with an IP like you said.
当您尝试使用您所说的IP连接时,Nginx不会代理转发您。
Here's an example from jwielder/nginx's README.md from its github repository 这是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 <================
Run this, edit your hosts file (something like sudo vim /etc/hosts
) add [ec2ip] whoami.local
then open your browser for http://whoami.local , that'll work just fine. 运行此命令,编辑您的主机文件(类似于
sudo vim /etc/hosts
),添加[ec2ip] whoami.local
然后打开浏览器访问http://whoami.local ,就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.