【问题标题】:WAMP Virtual Hosts SetupWAMP 虚拟主机设置
【发布时间】:2014-09-20 06:37:29
【问题描述】:

问题

我让 WAMP 愉快地运行,并决定设置虚拟主机。现在 WAMP 不会启动(卡在橙色上)。没有错误日志,因为 Apache 不会启动。

同样相关:此版本的 WAMP 侦听端口 81,而 MySQL 使用端口 3307。

请求

我已经在这几个小时了,看不到我的错误。如果有人能发现它,我将不胜感激。

Apache/conf/extra/httpd-vhosts

NameVirtualHost *:81

<VirtualHost *:81>
    DocumentRoot "C:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    ## Using Apache 2.4 syntax
    <Directory  "C:/wamp/www">
        Require local
        ## And possibly allow access from your local network
        ## Check you subnet for the actual values to use here
        Require ip 192.168.0
   </Directory>
</VirtualHost>


<VirtualHost *:81>
    DocumentRoot "C:/Users/Jo/My Websites/Demonstrations"
    ServerName demonstrations.com
    ServerAlias www.demonstrations.com
    Options Indexes FollowSymLinks

    ## Using Apache 2.4 syntax
    <Directory "C:/Users/Jo/My Websites/Demonstrations">
       AllowOverride All
       Require local
       #If you want to allow access from your internal network
       # For specific ip addresses add one line per ip address
       #Require ip 192.168.0.nnn
       # For every ip in the subnet, just use the first 3 numbers of the subnet
       #Require ip 192.168.0
       # If you want to allow access to everyone
       #Require all granted
    </Directory>

</VirtualHost>

Apache/conf/http.conf

DocumentRoot "c:/wamp/www/"
<Directory "c:/wamp/www/">

  Options Indexes FollowSymLinks
  AllowOverride All
  Require local

</Directory>

<Directory "C:/Users/Jo/My Websites/">
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1:81
</Directory>

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Windows/System32/drivers/etc/hosts.txt

127.0.0.1:81      localhost:81
127.0.0.1:81      demonstrators.com  #Site for demos

如果有人能发现我的错误,我将不胜感激。

【问题讨论】:

    标签: wamp


    【解决方案1】:

    试试这个

    首先删除httpd.conf中的这个条目

    <Directory "C:/Users/Jo/My Websites/">
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1:81
    </Directory>
    

    这是不必要的,因为 httpd-vhost.conf 文件中没有,而且您不能在该命令上使用端口号

    然后将你的主机文件更改为

    127.0.0.1      localhost
    127.0.0.1      demonstrators.com  #Site for demos
    ::1  localhost
    ::1  demonstrators.com 
    

    同样,这些语句不使用端口。

    一旦这些被更改,请尝试再次启动 Apache。

    如果无法启动,这是在 Apache 配置中查找错误的有用方法。

    启动一个命令窗口,然后 CD 到 \wamp\bin\apache\apache2.4.9\bin 文件夹

    运行此命令

    httpd -t
    

    这将验证您的 httpd.conf 及其包含的任何其他文件,并报告错误所在的行号。

    【讨论】:

    • 感谢 RiggsFolly - 对于新手来说,他是 WampServer 的大师 - 寻找他的指示。我会尝试每一个。
    猜你喜欢
    • 2013-03-15
    • 2014-07-15
    • 2015-01-25
    • 1970-01-01
    • 2016-01-23
    • 1970-01-01
    • 2011-09-30
    • 2013-04-13
    • 1970-01-01
    相关资源
    最近更新 更多