2013-03-05 58 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"