无法在xampp服务器中设置虚拟主机

时间:2015-05-10 16:28:41

标签: apache xampp virtualhost

我正在尝试在我的电脑中设置虚拟主机(Windows 7)。我正在使用带有apache 2.4.10的xampp v3.2.1,我在尝试启动apache serviece时从xampp控制面板获得以下消息。

9:55:07 PM  [Apache]    Error: Apache shutdown unexpectedly.
9:55:07 PM  [Apache]    This may be due to a blocked port, missing dependencies, 
9:55:07 PM  [Apache]    improper privileges, a crash, or a shutdown by another method.
9:55:07 PM  [Apache]    Press the Logs button to view error logs and check
9:55:07 PM  [Apache]    the Windows Event Viewer for more clues
9:55:07 PM  [Apache]    If you need more help, copy and post this
9:55:07 PM  [Apache]    entire log window on the forums

我正在尝试在C:\www目录上设置虚拟主机。以下是我在C:\xampp\apache\conf\extra\httpd-vhosts

中的设置
   <Directory C:/www>
   AllowOverride All
   Require all granted
   </Directory>
    #
    # Use name-based virtual hosting.
    #
    ##NameVirtualHost *:80
    <VirtualHost *:80>
    DocumentRoot "C:xampp/htdocs"
    ServerName localhost
    </VirtualHost>
    <VirtualHost *:80>
        #ServerAdmin webmaster@dummy-host2.example.com
        DocumentRoot "C:/www/saseco"
        ServerName saseco.dev
        #</VirtualHost>
    <VirtualHost *:80>
        DocumentRoot "C:/xampp/htdocs/"
        ServerName localhost
    <VirtualHost *:80>
        DocumentRoot "C:/www/saseco"
        ServerName saseco.dev
    </VirtualHost>

这就是我在windows ...\etc\hosts文件中包含的内容

    127.0.0.1       localhost
   #::1             localhost
    127.0.0.1       saseco.dev

我检查了很多教程,其中大多数都指导我按照我的方式创建虚拟主机。我的设置是否有任何错误。我也推迟了防火墙并删除了Skype,以防问题是由它们造成的(如某些教程中所述)。

1 个答案:

答案 0 :(得分:1)

您的路由器上是否已转发端口80?点击这里:
http://www.yougetsignal.com/tools/open-ports/
如果没有,您将需要端口转发80端口。