配置httpd-vhosts.conf以访问http:// IP / v-host

时间:2013-07-22 10:53:28

标签: apache xampp vhosts

我需要帮助才能正确配置我的httpd-vhosts.conf。我正在使用xampp,它是默认的vhost配置:

<VirtualHost *:80>
    ServerAdmin postmaster@myhost
    DocumentRoot "D:/xampp/htdocs/myhost"
    ServerName myhost
    AllowEncodedSlashes NoDecode
    ErrorLog "logs/myhost.localhost-error.log"
    CustomLog "logs/myhost.localhost-access.log" combined
</VirtualHost>

我想配置它,它将使用此掩码 - IP /主机,例如:

    http://199.99.99.9/my-host1
    http://199.99.99.9/my-host2
    #199.99.99.9 is my IP

任何帮助人员都会很棒。

1 个答案:

答案 0 :(得分:1)

这是将{vhost}添加到xampp

guide
  

例如,假设您有另一个ClientB网站。您将在hosts文件中添加127.0.0.1 clientB.local,C:\ xampp \ apache \ conf \ extra \ httpd-vhosts.conf将如下所示:

NameVirtualHost *80
  <VirtualHost *>
    DocumentRoot "C:\xampp\htdocs"
    ServerName localhost
  </VirtualHost>
  <VirtualHost *>
    DocumentRoot "C:\Documents and Settings\Me\My Documents\clientA\website"
    ServerName clientA.local
  <Directory "C:\Documents and Settings\Me\My Documents\clientA\website">
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
<VirtualHost *>
    DocumentRoot "C:\Documents and Settings\Me\My Documents\clientB\website"
    ServerName clientB.local
  <Directory "C:\Documents and Settings\Me\My Documents\clientB\website">
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

重新启动 httpd