1

私を助けてください、私は髪を引っ張っています。仮想ホストを WAMP で動作させることができません。この行のコメントを外しました:

# 仮想ホスト
conf/extra/httpd-vhosts.conf を含める

これは私の httpd-vhosts.conf ファイルです:

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost 127.0.0.1>
    DocumentRoot "C:\wamp\www"
    ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1>
    DocumentRoot "C:\wamp\www\project\public"
    ServerName project
    ErrorLog "logs/project.localhost.error.log"
    CustomLog "logs/project.localhost.access.log" common
</VirtualHost>

私は何を間違っていますか?私のエラーはどこですか?仮想ホストが表示されないのはなぜですか?

4

2 に答える 2

1

私は答えを見つけました。Windows ホスト ファイルにホスト名を追加するのを忘れていました。

于 2010-06-27T17:01:42.290 に答える
0

サーバー上のホスト ファイルを編集する必要があります。これにより、仮想ホスト名が IP アドレスにマップされます。これを簡単にするために、127.0.0.1 を mysite にマップします。方法は次のとおりです。

  1. 管理者としてメモ帳を開きます。
  2. ファイル C:\Windows\system32\drivers\etc\hosts を開きます。
  3. 次の行を追加します: 127.0.0.1 mysite.
  4. ホスト ファイルを保存します (.txt ファイルとして保存しないように注意してください)。
于 2021-06-02T11:02:43.887 に答える