2014-01-26 58 views
0

我已經在我的小牛隊上安裝了xampp,即使當我認爲自己會這樣做時,我也會通過虛擬主機的配置進行配置,但它仍然無法正常工作。我找不到任何地方的問題,我查看了所有可能與它有關的文件,重寫了/etc/hosts文件../xamppfiles/etc/extra/httpd-vhosts.conf../xamppfiles/etc/httpd.conf,但是當我瀏覽器並鍵入我的虛擬主機指定的地址它不起作用時,它會拋出我一個谷歌搜索。我也嘗試添加另一個虛擬主機,但同樣的情況發生。xampp在小牛隊上設置虛擬主機

我的虛擬主機文件看起來像這樣: 了NameVirtualHost *:80

# localhost 
<VirtualHost *:80> 
ServerName "localhost" 
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/xampp" 
<Directory "/Applications/XAMPP/xamppfiles/htdocs/xampp"> 
    Options Indexes FollowSymLinks Includes execCGI 
    AllowOverride All 
    Allow From All 
    Order Allow,Deny 
</Directory> 
</VirtualHost> 


# My custom host 
<VirtualHost *:80> 
ServerName "site1.local" 
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/site1" 
<Directory "/Applications/XAMPP/xamppfiles/htdocs/site1"> 
    Options Indexes FollowSymLinks Includes ExecCGI 
    Order allow,deny 
    Allow from all 
    AllowOverride All 
    Require all granted 
</Directory> 
ErrorLog "Applications/XAMPP/xamppfiles/htdocs/site1/site1.local-error_log" 
</VirtualHost> 

我也加入了這一行到主機的底部文件:

# XAMPP VirtualHost mappings 
127.0.0.1 site1.local 

而且在註釋掉行的httpd .conf

Include etc/extra/httpd-vhosts.conf 

我已禁用.htaccess文件將其重命名爲htaccess並註釋掉所有內容。

我真的不知道自己還能做什麼,它仍然不工作: -/

我沒有忘記,分別重新啓動Apache服務器。

回答

1

您的虛擬主機文件缺少反斜槓。它應該是這樣的:

# localhost 
<VirtualHost *:80> 
ServerName "localhost" 
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/xampp" 
<Directory "/Applications/XAMPP/xamppfiles/htdocs/xampp/"> 
    Options Indexes FollowSymLinks Includes execCGI 
    AllowOverride All 
    Allow From All 
    Order Allow,Deny 
</Directory> 
</VirtualHost> 
# My custom host 
<VirtualHost *:80> 
ServerName "site1.local" 
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/site1" 
<Directory "/Applications/XAMPP/xamppfiles/htdocs/site1/"> 
    Options Indexes FollowSymLinks Includes ExecCGI 
    Order allow,deny 
    Allow from all 
    AllowOverride All 
    Require all granted 
</Directory> 
ErrorLog "Applications/XAMPP/xamppfiles/htdocs/site1/site1.local-error_log" 
</VirtualHost> 

投放到瀏覽器 http://site1.local/ ,它應該是工作。