1条回答
- jmctian 2020-05-20 17:33关注
把niginx的配置文件发出来。通常容器具有不同的Docker网络。所以如果在
proxy_pass
中设置 upstream 时,需要避免使用错误的 ip 地址。更新说明:
确认本机的80端口没有被占用,通过以下命令来检查
netstat -ltn
执行以下命令
docker run --name mynginx1 -p 80:80 -d nginx
查看运行状态,结果应该是这样的
# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 55842f880365 nginx "nginx -g 'daemon ..." 16 seconds ago Up 15 seconds 0.0.0.0:80->80/tcp mynginx1
注意这里的COMMAND和你的不一样哦
测试
# curl localhost:80 <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html>
解决 无用评论 打赏 举报
悬赏问题
- ¥15 ads仿真结果在圆图上是怎么读数的
- ¥20 Cotex M3的调试和程序执行方式是什么样的?
- ¥20 java项目连接sqlserver时报ssl相关错误
- ¥15 一道python难题3
- ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
- ¥15 牛顿斯科特系数表表示
- ¥15 arduino 步进电机
- ¥20 程序进入HardFault_Handler
- ¥15 oracle集群安装出bug
- ¥15 关于#python#的问题:自动化测试