1

私は2つのフォルダを持っています:

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
4

2 に答える 2

1

一般的な Web ディレクトリ (www など) に入る前に別れた仮想ホストを見たことがあるとは言えませんが、これを試みて 403 を受け取った場合は、余分な DocumentRoot "c:ドキュメントの上部にある /wamp/www/" は、オープン ベース ディレクトリ違反のように見えます。Apache エラー ログには、403 を返す理由に関するより具体的な情報が含まれているはずです。

エラー ログを確認せずに、最初のドキュメント ルート宣言を次のように変更してみます。

DocumentRoot "c:/wamp/"

しかし、私が言ったように、なぜ www の外でページをホストしたいのかわかりません。それはセキュリティ上の理由からだと思います。

于 2013-01-19T00:07:32.477 に答える
0

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.domain は独自のものに変更する必要があります。

これがお役に立てば幸いです。ありがとう。

于 2014-05-23T06:30:24.723 に答える