【发布时间】:2017-10-09 10:49:26
【问题描述】:
我有一个小型的迷你博客烧瓶应用程序。我这样执行这个应用程序:
$ gunicorn gunluk:app -p gunluk.pid -b 0.0.0.0:8000
我可以这样访问它:
但我想做的是在不指定端口名称的情况下访问站点:
当前ip表规则列表:
$ sudo iptables -nvL
Chain INPUT (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
62 7092 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8000
593 67706 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5000
3631 3641K ACCEPT all -- enp1s0 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8000
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
655 74798 ACCEPT all -- * lo 0.0.0.0/0 0.0.0.0/0
2790 322K ACCEPT all -- * enp1s0 0.0.0.0/0 0.0.0.0/0
还有路由器界面中的端口转发设置如下:
Interface Protocol Input Port Output Port Server IP Adress Name Status
nas_8_35 TCP 5000-5000 5000-5000 192.168.1.2 5000 Active
nas_8_35 TCP 8080-8080 8080-8080 192.168.1.2 web2 Active
nas_8_35 TCP/UDP 8000-8000 8000-8000 192.169.1.2 8000 Active
nas_8_35 TCP/UDP 80-80 80-80 192.168.1.2 http Active
我没有静态ip,我用的是免费的动态dns服务,动态ip地址。
【问题讨论】:
标签: python nginx networking flask gunicorn