mod_wsgi不允许外部访问flask应用程序

2024-10-01 02:24:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我在一个lamp服务器上使用mod\wsgi,在那里我试图部署一个Flask应用程序,但是在我的局域网外是看不到的。我已将主应用程序设置为使用应用程序运行(host='0.0.0.0'),它也未处于调试模式。我有服务器设置的iptables。。。在

    target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere             ctstate NEW,RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https
DROP       all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

我阻止了5000端口,因为从局域网可以通过这些设置访问服务器。在

这是我的wsgi文件。在

^{pr2}$

这是我在/etc/apache2/sites available/SnakeByte中的文件

<VirtualHost *:80>
        ServerName snakebyte.us

        WSGIDaemonProcess SnakeByte user=user1 group=group1 threads=5
        WSGIScriptAlias / /var/www/SnakeByte/SnakeByte.wsgi
        <Directory /var/www/SnakeByte/SnakeByte/>
            WSGIProcessGroup SnakeByte
            WSGIApplicationGroup %{GLOBAL}  
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

Tags: 服务器应用程序wsgisourcetargetalldestinationtcp