WAMP虚拟主机设置

时间:2014-07-28 23:36:56

标签: wamp

问题

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

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

请求

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

阿帕奇/ CONF /额外/ httpd的的虚拟主机

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>

阿帕奇/ 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

窗/ System32下/驱动程序的/ etc / HOSTS.TXT

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

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

1 个答案:

答案 0 :(得分: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及其包含的任何其他文件,并报告错误所在的行号。