WAMP 403在多个虚拟主机


WAMP 403 on Multiple Virtual Hosts

我有两个文件夹:

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

在我的www文件夹中,我有.htaccess作为我的CodeIgniter应用程序,所以我可以有这样的url site.com/controller/method

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

我想在coll中运行协作应用程序,在www中运行ci,这就是我如何设置httpd.conf

DocumentRoot "c:/wamp/www/"
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    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

我不能说我曾经见过虚拟主机在你甚至进入一个普通的网络目录(如www)之前就分开了,但如果我尝试这样做,并得到403,我会看看你文档顶部的额外DocumentRoot "c:/wamp/www/" -对我来说看起来像一个开放的基本目录违规。您的apache错误日志应该有更多关于它为什么返回403的具体信息。

如果不查看错误日志,我会尝试将第一个文档根声明更改为:

DocumentRoot "c:/wamp/"

但是就像我说的,我不知道为什么你想要在www之外托管页面-我相信这是出于安全原因。

对于localhost不需要添加项

应该是这样的。

# your vhost
<VirtualHost *:80>
    ServerAdmin email@your.vhost.domain
    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。域名必须更改为您自己的。

希望这对你有帮助。谢谢。