ubuntu - docker 相同端口转发不能访问
伊谢尔伦
伊谢尔伦 2017-04-24 09:13:08
0
3
697

系统:Ubuntu 14.04 x64

1,在本地虚拟机搭建的Ubuntu14.04 配置的docker-compose.yml 相同端口和不同端口的转发,都能访问

2,在服务器上使用相同的配置文件, docker-compose up -d 启动之后,
在服务器上使用 curl http://127.0.0.1:80 能访问, 使用 curl http://服务器IP:80,就不能访问,
如果把端口改成 81:80 通过http://服务器IP:81 也能访问

netstat 看过端口,80没有被占用


docker-compose.yml 配置

  ports:
    - "80:80"
    - "3001:3000"

服务器端:

0.0.0.0:80->80/tcp
0.0.0.0:3001->3000/tcp
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
迷茫
  1. Can port 3001 be accessed?

  2. It should be that port 80 is blocked by the firewall...

Install nmap on another server

sudo apt-get install nmap

Then execute the following command to check whether port 80 is blocked:

sudo nmap -p80 192.168.59.1

192.168.59.1 is the IP of the first server.

If port 80 is blocked, the output status is filtered

小葫芦

If port 80 is occupied, it will prompt that the port is occupied when starting the container. Therefore, if the container starts normally, the problem of port occupation can be basically eliminated. In addition, port 81 is normal, but there is a problem with port 80, which means that port 80 may be specially taken care of. Although the firewall of the Ubuntu system is turned off by default, it is best to check it.

洪涛

1. Check the local firewall of the server
2. Contact the server provider and ask if 80 is blocked

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template