【问题标题】:Config httpd-vhosts.conf to access like http://IP/v-host配置 httpd-vhosts.conf 以访问 http://IP/v-host
【发布时间】:2013-07-21 01:52:14
【问题描述】:

我需要帮助来正确配置我的 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

任何帮助的人都会很棒。

【问题讨论】:

    标签: apache xampp vhosts


    【解决方案1】:

    这是一个 guide 将 vhost 添加到 xampp

    例如,假设您有另一个客户 B 的网站。您将在 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

    【讨论】:

    猜你喜欢
    • 2014-02-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-06
    • 2021-12-14
    • 2017-07-28
    • 2021-09-21
    • 1970-01-01
    相关资源
    最近更新 更多