0

我需要帮助来正确配置我的 httpd-vhosts.conf。我正在使用 xampp,它是默认的虚拟主机配置:

<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

任何帮助的人都会很棒。

4

1 回答 1

1

这是将 vhost 添加到 xampp的指南

例如,假设您有另一个用于 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

于 2013-07-22T12:59:46.810 回答