如何通过互联网访问apache django上托管的网站

时间:2017-08-10 17:09:54

标签: python django apache

我有一个在Linux VM上使用django在apache服务器上设置的站点。这是conf文件:

<VirtualHost *:80>

    ServerAdmin webmaster@localhost
    DocumentRoot /home/sharan/myproject

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /static /home/sharan/myproject/proj_VivRx1/app_match/static
    <Directory /home/sharan/myproject/proj_VivRx1/app_match/static>
        Require all granted
    </Directory>

    <Directory /home/sharan/myproject/proj_VivRx1/proj_VivRx1>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    <Directory /home/sharan/myproject/proj_VivRx1/proj_VivRx1>
        Require all granted
    </Directory>

    <Directory /home/sharan/myproject/proj_VivRx1>
        Require all granted
    </Directory>

    <Directory /home/sharan/myproject/myprojectenv>
        Require all granted
    </Directory>

    WSGIDaemonProcess myproject python-path=/home/sharan/myproject/proj_VivRx1 python-home=/home/sharan/myproject/myprojectenv
    WSGIProcessGroup myproject
    WSGIScriptAlias / /home/sharan/myproject/proj_VivRx1/proj_VivRx1/wsgi.py

</VirtualHost>

我可以在本地机器浏览器中访问服务器IP地址,该网站运行正常。 如何通过互联网从另一台机器访问该站点进行测试? 我尝试使用ip地址,但“无法访问网站”

与建议的副本不同,因为我的问题是通过互联网访问,而不是来自本地IP,而且,我已经尝试了其中建议的答案

1 个答案:

答案 0 :(得分:0)

|我尝试使用ip地址,但“无法访问网站”

这让我觉得你在另一个层有问题 - 如果没有规则适用于你的请求URL,apache将返回404's,如果你的web应用程序出现问题(如果崩溃或无法访问,则为5XX)

无法访问网站表示存在防火墙问题,或者当您要引用外部地址时,引用的IP地址是内部的。