无法使用网站 url 访问网站(本地主机:端口有效)
not able to access website using website url ( localhost: port works )
我有以下配置:
主持人:Windows7
虚拟化软件:VirtualBox
访客:Ubuntu 15.10 32 位
apache 版本:Apache/2.4.12 (Ubuntu)
网站配置如下:(Orignal)
<VirtualHost *:8888>
ServerAdmin webmaster@localhost
ServerName testSite.com
ServerAlias www.testSite.com
DocumentRoot /srv/www/testSite.com/web/
ErrorLog /srv/www/testSite.com/logs/error.log
CustomLog /srv/www/testSite.com/logs/access.log combined
<Directory /srv/www/testSite.com/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
Require all granted
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
现在当我访问 :
127.0.0.1:8888
我可以访问该网页。但是当我尝试时:
http://testSite.com/index.html
没用
我想,这是一些重定向问题,所以我将 /etc/hosts 更改为以下内容
127.0.0.1 testSite.com
还是不行。
请指出我做错了什么?
因为您正在监听非标准端口号,即 8888,所以必须将此端口号添加到所有 url。
所以你必须使用
http://testSite.com:8888/index.html
补充说明:
您在此处还混合了 Apache 2.2 和 Apache 2.4 访问语法因此,当您使用 Apache 2.4 时,您可以删除 Apache 2.2 语法,请参阅注释掉的行。
<Directory /srv/www/testSite.com/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
# Order allow,deny
# allow from all
Require all granted
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
我有以下配置:
主持人:Windows7
虚拟化软件:VirtualBox
访客:Ubuntu 15.10 32 位
apache 版本:Apache/2.4.12 (Ubuntu)
网站配置如下:(Orignal)
<VirtualHost *:8888>
ServerAdmin webmaster@localhost
ServerName testSite.com
ServerAlias www.testSite.com
DocumentRoot /srv/www/testSite.com/web/
ErrorLog /srv/www/testSite.com/logs/error.log
CustomLog /srv/www/testSite.com/logs/access.log combined
<Directory /srv/www/testSite.com/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
Require all granted
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
现在当我访问 :
127.0.0.1:8888
我可以访问该网页。但是当我尝试时:
http://testSite.com/index.html
没用
我想,这是一些重定向问题,所以我将 /etc/hosts 更改为以下内容
127.0.0.1 testSite.com
还是不行。
请指出我做错了什么?
因为您正在监听非标准端口号,即 8888,所以必须将此端口号添加到所有 url。
所以你必须使用
http://testSite.com:8888/index.html
补充说明:
您在此处还混合了 Apache 2.2 和 Apache 2.4 访问语法因此,当您使用 Apache 2.4 时,您可以删除 Apache 2.2 语法,请参阅注释掉的行。
<Directory /srv/www/testSite.com/web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
# Order allow,deny
# allow from all
Require all granted
AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonDebug On
</Directory>