2012-03-12 2 views
1

OSをバーチャルホストにリダイレクトします:WinXPのlocalhostが

はサーバー:XAMPP(Apacheの)

空のプロジェクトを作成するために、ZendのCLIツールを使用した後、私は私のhttpd-vhosts.confに提案バーチャルホストセクションを追加し、 hostsファイルにプロジェクト名を追加しました。私のプロジェクトのクイックスタートページは正常に表示されます。しかし、パス 'localhost'は、通常のxmappホームページではなく、プロジェクトページをレンダリングするようになりました。

これは私の仕事を止めさせるものではありません。私はxamppのホームページをまったく使っていません。しかし、私は将来、より多くの仮想ホストを追加すると、矛盾が生じることに懸念しています。

他の関連記事では、NameVirtualHost行のコメントを外しました。しかし、それは仕事のように見えませんでした。それから私は、次の各を試みたが、無駄に:

  • NameVirtualHost *が
  • NameVirtualHostでのlocalhost:80に
  • がNameVirtualHost *:80

のhttpd-vhosts.conf

NameVirtualHost localhost 

<VirtualHost *:80> 
    DocumentRoot "C:/xampp/htdocs/cv/public" 
    ServerName .local 

    # This should be omitted in the production environment 
    SetEnv APPLICATION_ENV development 

    <Directory "C:/xampp/htdocs/cv/public"> 
     Options Indexes MultiViews FollowSymLinks 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 

</VirtualHost> 

ホスト

127.0.0.1  localhost 
127.0.0.1  cv 

答えて

1

読んでから、.localが問題のようです。

# Setup "helloworld" Virtual Host 
<VirtualHost *:80> 
ServerName helloworld.tld 
DocumentRoot "C:\projects\helloworld\public" 

    <Directory "C:\projects\helloworld\public"> 
     Options Indexes FollowSymLinks Includes 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

出典:あなたはServerNameディレクティブを変更する必要がhttp://cv/http://survivethedeepend.com/zendframeworkbook/en/1.0/creating.a.local.domain.using.apache.virtual.hosts#zfbook.creating.a.local.domain.using.apache.virtual.hosts.configuring.local.hosts.file

+0

http://httpd.apache.org/docs/2.0/vhosts/name-based.html – Jake

+0

http://httpd.apache.org/docs/2.0/vhosts/examples.html – Jake

+0

ありがとう。リンクは特に有用でした。それは確かに私のブックマークに入っています。 – dsulli

1

URLを使ってサイトにアクセスします。状況をきれいにするには、http://*.local.net/

のようなパターンを使用してください。プロキシを使用している場合は、そのパターンをブラウザに例外として追加してください。

NameVirtualHost localhost 

<VirtualHost *:80> 
    DocumentRoot "C:/xampp/htdocs/cv/public" 
    ServerName cv.local.net 

    # This should be omitted in the production environment 
    SetEnv APPLICATION_ENV development 

    <Directory "C:/xampp/htdocs/cv/public"> 
     Options Indexes MultiViews FollowSymLinks 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 

</VirtualHost>