我有一个通过端口5000运行的Flask服务器,很好。我可以在http://example.com:5000上访问它
但是是否可以在http://example.com上简单地访问它?我假设这意味着我必须将端口从5000更改为80。但是当我在Flask上尝试该端口时,运行该错误消息。
Traceback (most recent call last):
File "xxxxxx.py", line 31, in <module>
app.run(host="0.0.0.0", port=int("80"), debug=True)
File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line 772, in run
run_simple(host, port, self, **options)
File "/usr/local/lib/python2.6/dist-packages/werkzeug/serving.py", line 706, in run_simple
test_socket.bind((hostname, port))
File "<string>", line 1, in bind
socket.error: [Errno 98] Address already in use
连续lsof -i :80
收益
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apache2 467 root 3u IPv4 92108840 0t0 TCP *:www (LISTEN)
apache2 4413 www-data 3u IPv4 92108840 0t0 TCP *:www (LISTEN)
apache2 14346 www-data 3u IPv4 92108840 0t0 TCP *:www (LISTEN)
apache2 14570 www-data 3u IPv4 92108840 0t0 TCP *:www (LISTEN)
apache2 14571 www-data 3u IPv4 92108840 0t0 TCP *:www (LISTEN)
apache2 14573 www-data 3u IPv4 92108840 0t0 TCP *:www (LISTEN)
我需要先杀死这些进程吗?这样安全吗?还是有另一种方法可以使Flask在端口5000上运行,但是使主网站域以某种方式重定向?