2013-03-05 139 views
0

我已经阅读了很多关于虚拟主机设置的文章和文章,但我无法弄清楚是哪个问题。在xampp中设置虚拟主机的错误

我有一个Win7电脑,我安装了一个xampp来管理我的php + mysql项目。 按照默认的Web根目录为C:\ XAMPP \ htdocs中 为了避免与Skype冲突我设置好的Apache将在8080端口上

工作,如果我浏览到类似本地主机:8080/mysubdir它工作正常。

我的想法是,现在到Apache的根目录指向个人电脑上的另一个目录:在这里我想指出我的根目录的目录为C:\ Users \用户为myuser \谷歌驱动器\ CODE_REPOS

我搜查并且VirtualHost似乎是可能的; 这里我的配置

apache httpd.conf 
#Listen [::]:80 
Listen *:8080 

# Virtual hosts 
#Include "conf/extra/httpd-vhosts.conf" 

这里我的httpd-vhosts.conf

# Use name-based virtual hosting. 
# 
NameVirtualHost *:8080 
# 
# VirtualHost example: 
# Almost any Apache directive may go into a VirtualHost container. 
# The first VirtualHost section is used for all requests that do not 
# match a ServerName or ServerAlias in any <VirtualHost> block. 
# 
<VirtualHost *:8080> 
    ServerAdmin [email protected] 
    DocumentRoot "C:/xampp/htdocs" # change this line with your htdocs folder 
    ServerName localhost 
    ServerAlias localhost 
    <Directory "C:/xampp/htdocs"> 
     Options Indexes FollowSymLinks Includes ExecCGI 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 
<VirtualHost development.loc:8080> 
    ServerAdmin [email protected] 
    DocumentRoot "C:/Users/myuser/Google Drive/CODE_REPOS" # change this line with your htdocs folder 
    ServerName development.loc 
    ServerAlias development.loc 
    <Directory "C:/Users/myuser/Google Drive/CODE_REPOS"> 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

现在在C代码:\ WINDOWS \ SYSTEM32 \ DRIVERS \等\主机

# localhost name resolution is handled within DNS itself. 
# 127.0.0.1  localhost 
# ::1    localhost 
    127.0.0.1  localhost 
    127.0.0.1  development.loc 

如果我停止Apache,取消注释#Include“conf/extra/httpd-vhosts.conf”并尝试再次启动Apache,立即启动并停止。

我不明白我错过了什么。

+0

你检查你的Apache日志开始删除哈希? – 2013-04-02 13:41:01

回答

0

从包括线

apache httpd.conf 
    #Listen [::]:80 
    Listen *:8080 

    # Virtual hosts 
    include "conf/extra/httpd-vhosts.conf"