【问题标题】:not able to access website using website url ( localhost: port works )无法使用网站 url 访问网站(本地主机:端口有效)
【发布时间】:2016-03-22 04:42:14
【问题描述】:

我有以下配置:

主机: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

还是不行。

请提出我做错了什么?

【问题讨论】:

    标签: apache ubuntu web virtualbox


    【解决方案1】:

    因为你正在监听一个非标准的端口号,即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>
    

    【讨论】:

      猜你喜欢
      • 2015-06-06
      • 2012-08-14
      • 2018-04-07
      • 2016-01-10
      • 1970-01-01
      • 2013-11-21
      • 2014-09-15
      • 2010-09-22
      • 1970-01-01
      相关资源
      最近更新 更多