2013-01-18 113 views
1

我有兩個文件夾:WAMP 403多臺虛擬主機

c:wamp:www // My root 
c:wamp:coll // Alternative 

在我www文件夾中,我有.htaccess我笨的應用程序,這樣我可以有鏈接的,像這樣site.com/controller/method

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [L] 
RewriteRule ^.*$ index.php [L] 

我想運行合作者應用程序在科爾和我的ci在www這是我如何設置我的httpd.conf

DocumentRoot "c:/wamp/www/" 

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot "c:/wamp/www/" 
    ServerName localhost 
    ErrorLog "logs/localhost-error.log" 
    CustomLog "logs/localhost-access.log" common 
    <directory "c:/wamp/www/"> 
     Options Indexes FollowSymLinks 
     AllowOverride all 
     Order Deny,Allow 
     Deny from all 
     Allow from 127.0.0.1 
    </directory> 
</VirtualHost> 
<VirtualHost *:80> 
    DocumentRoot "c:/wamp/coll/" 
    ServerName project.localhost 
    <directory "c:/wamp/coll/"> 
     Options Indexes FollowSymLinks 
     AllowOverride all 
     Order Deny,Allow 
     Deny from all 
     Allow from 127.0.0.1 
    </directory> 
</VirtualHost> 

我都需要的模塊激活:

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

LoadModule vhost_alias_module modules/mod_vhost_alias.so 
LoadModule rewrite_module modules/mod_rewrite.so 

而且我hosts文件如下:

127.0.0.1 localhost 
127.0.0.1 project.localhost 

錯誤日誌:

[Fri Jan 18 23:30:11 2013] [notice] Apache/2.2.22 (Win64) PHP/5.4.3 configured -- resuming normal operations 
[Fri Jan 18 23:30:11 2013] [notice] Server built: May 13 2012 19:41:17 
[Fri Jan 18 23:30:11 2013] [notice] Parent: Created child process 1872 
[Fri Jan 18 23:30:11 2013] [notice] Child 1872: Child process is running 
[Fri Jan 18 23:30:11 2013] [notice] Child 1872: Acquired the start mutex. 
[Fri Jan 18 23:30:11 2013] [notice] Child 1872: Starting 64 worker threads. 
[Fri Jan 18 23:30:11 2013] [notice] Child 1872: Starting thread to listen on port 80. 
[Fri Jan 18 23:30:11 2013] [notice] Child 1872: Starting thread to listen on port 80. 
[Fri Jan 18 23:30:15 2013] [notice] Parent: Received shutdown signal -- Shutting down the server. 
[Fri Jan 18 23:30:15 2013] [notice] Child 1872: Exit event signaled. Child process is ending. 
[Fri Jan 18 23:30:16 2013] [notice] Child 1872: Released the start mutex 
[Fri Jan 18 23:30:17 2013] [notice] Child 1872: All worker threads have exited. 
[Fri Jan 18 23:30:17 2013] [notice] Child 1872: Child process is exiting 
[Fri Jan 18 23:30:17 2013] [notice] Parent: Child process exited successfully. 
[Fri Jan 18 23:41:31 2013] [notice] Apache/2.2.22 (Win64) PHP/5.4.3 configured -- resuming normal operations 
[Fri Jan 18 23:41:31 2013] [notice] Server built: May 13 2012 19:41:17 
[Fri Jan 18 23:41:31 2013] [notice] Parent: Created child process 5380 
[Fri Jan 18 23:41:32 2013] [notice] Child 5380: Child process is running 
[Fri Jan 18 23:41:32 2013] [notice] Child 5380: Acquired the start mutex. 
[Fri Jan 18 23:41:32 2013] [notice] Child 5380: Starting 64 worker threads. 
[Fri Jan 18 23:41:32 2013] [notice] Child 5380: Starting thread to listen on port 80. 
[Fri Jan 18 23:41:32 2013] [notice] Child 5380: Starting thread to listen on port 80. 
[Fri Jan 18 23:41:41 2013] [notice] Parent: Received shutdown signal -- Shutting down the server. 
[Fri Jan 18 23:41:41 2013] [notice] Child 5380: Exit event signaled. Child process is ending. 
[Fri Jan 18 23:41:42 2013] [notice] Child 5380: Released the start mutex 
[Fri Jan 18 23:41:43 2013] [notice] Child 5380: All worker threads have exited. 
[Fri Jan 18 23:41:43 2013] [notice] Child 5380: Child process is exiting 
[Fri Jan 18 23:41:43 2013] [notice] Parent: Child process exited successfully. 
Warning: DocumentRoot [C:/wamp/coll'] does not exist 
Warning: DocumentRoot [C:/apache2/docs/dummy-host.example.com] does not exist 
+0

我可以找到問題或發現一個錯誤,但嘿!你應該使用2個不同的子目錄c:/ wamp/www/like ** c:/ wamp/www/codeigniter **&** c:/ wamp/www/collaborator/** –

+0

我不能有兩個不同的目錄根 ? –

+0

...因此,您使用虛擬主機! –

回答

1

我不能說我有曾經見過的虛擬主機在你進入一個普通的網絡目錄(如www)之前就已經分開了,但是如果我正在嘗試這個,並且獲得403s,我會確定在文檔頂部的額外DocumentRoot「c:/ wamp/www /」 - 看起來像是對我開放的基本目錄違例。 Apache的錯誤日誌有關於爲什麼它返回一個403

沒有看到錯誤日誌,我會嘗試改變,首先文檔根目錄聲明的更多具體信息:

DocumentRoot "c:/wamp/" 

但就像我說的,我不知道你爲什麼要在www外部託管頁面 - 我相信這是出於安全原因。

+0

但是,如果我打開project.localhost我沒有問題,只有問題,我得到的是當我訪問本地然後我得到了403.更改爲DocumentRoot沒有幫助 –

+0

有沒有什麼在你的錯誤日誌提供線索? –

+0

添加了我的錯誤日誌 –

0

本地主機無需添加項目。

它應該這樣工作。

# your vhost 

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot "your.vost.doc.root" 
    ServerName your.vhost.domain 
    ErrorLog "logs/your.vhost.domain.log" 
    CustomLog "logs/your.vhost.domain-access.log" common 
    <Directory "your.vost.doc.root"> 
     Options Indexes FollowSymLinks 
     AllowOverride None 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

# 
# Localhost 
# 

<VirtualHost *:80> 
    DocumentRoot C:/wamp/www # wamp doc root 
    ServerName localhost 
</VirtualHost> 

* your.vhost.domain必須更改爲您自己的。

希望這可以幫助你。謝謝。