【发布时间】:2017-08-10 17:09:54
【问题描述】:
我有一个使用 django 在 linux VM 上的 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地址,并且该站点运行良好。 如何通过 Internet 从另一台机器访问该站点进行测试? 我尝试使用 IP 地址,但“无法访问站点”
与建议的副本不同,因为我的问题是通过互联网访问,而不是从本地 IP 访问,而且我已经尝试了其中建议的答案
【问题讨论】:
-
你在 Django 设置中设置了
ALLOWED_HOSTS吗? -
是的,我已将“*”添加到允许的主机。
-
这个问题是通过本地IP访问的。我正在尝试通过 Internet 访问该站点。另外,我已经尝试了那里的答案。