3

ローカルの apache2 サーバーに複数の仮想ホストをセットアップしようとしています。私の目標は、Zend プロジェクトのブラウザーで「zf2-tutorial.localhost」に移動し、Symfony プロジェクトの「symfony.localhost」に移動できるようにすることです。現在、「zf2-tutorial.localhost」または「symfony.localhost」のどちらにアクセスしても、Zend プロジェクトが提供されます。これが私の http.conf ファイルの一部です

<VirtualHost *:80>
    ServerName zf2-tutorial.localhost
    DocumentRoot /Users/myusername/Sites/Zend/public
    SetEnv APPLICATION_ENV "development"
    <Directory /Users/myusername/Sites/Zend/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
        Options Indexes FollowSymLinks
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName symfony.localhost
    DocumentRoot /Users/myusername/Sites/symfony
    SetEnv APPLICATION_ENV "development"
    ServerAlias www.symfony.localhost
</VirtualHost>

私の「hosts」ファイルはこれらの2行で終わります

127.0.0.1 zf2-tutorial.localhost localhost
127.0.0.1 symfony.localhost localhost

私は何を間違っていますか?

4

1 に答える 1

3

バージョン2.3.11より前の Apache を実行している場合は、 NameVirtualHostディレクティブを使用するのを忘れています。

NameVirtualHost *:80

バージョン2.2または2.4の Apache Virtual Host のドキュメントも読む必要があります。

于 2013-02-09T00:38:11.797 に答える