使用 WAMP 的虚拟主机 [英] Virtual Host with WAMP

查看:33
本文介绍了使用 WAMP 的虚拟主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Wamp 2.2,编辑了 conf/extra/httpd-vhosts.conf 编辑了这个文件以添加 VirtualHosts ,但是当我在 httpd.conf 中取消注释行时code> 包含 httpd-vhosts.conf 文件,重新启动 Wamp 后不会启动.如果我恢复更改工作正常.

I'm using Wamp 2.2, edited conf/extra/httpd-vhosts.conf edited this file to add VirtualHosts , but when I un-commented line in httpd.conf to include httpd-vhosts.conf file, after restarting Wamp doesn't starts. If I revert changes is works fine.

知道为什么会这样吗?

这是我在 httpd-vhost.conf 中使用的代码:

This is code I'm using in httpd-vhost.conf:

<VirtualHost *>
    ServerAdmin admin@localhost.com
    DocumentRoot "C:/wamp/www" # change this line with your htdocs folder
    ServerName localhost
    ServerAlias localhost
    <Directory "C:/wamp/www">
        Options Indexes FollowSymLinks Includes ExecCGI
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

# WooCommerce Multisite
<VirtualHost dev.lo>
    ServerAdmin admin@localhost.com
    DocumentRoot "C:/wamp/www/dev"
    ServerName dev.lo
    ServerAlias dev.lo
    <Directory "C:/wamp/www/dev">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

谢谢

乔治

编辑

正如 Andreas Hagen 所建议的,我通过 httpd.exe 运行 Apache.

As Andreas Hagen suggested, I run Apache via httpd.exe.

第一个错误是 DocumentRoot 的错误参数,当 DocumentRoot 只接受一个时,出现的注释像被当作第二个参数.

First error was wrong parameter for DocumentRoot, as appears comment like was taken as second parameter, when DocumentRoot accepts only one.

然后我收到警告:[warn] NameVirtualHost *:80 has no VirtualHosts.进行了快速搜索,发现了非常有用的问题 - https://serverfault.com/questions/1405/apache-2-startup-warning-namevirtualhost-80-has-no-virtualhosts

Then I got warning: [warn] NameVirtualHost *:80 has no VirtualHosts. Did a quick search and found very helpful question - https://serverfault.com/questions/1405/apache-2-startup-warning-namevirtualhost-80-has-no-virtualhosts

推荐答案

可能是 vhosts 文件中的一些错误配置.尝试从命令行启动 apache,以便获得错误输出.这将帮助您确定您的问题.

Probably some bad config in vhosts file. Try to start apache from commandline so you get the error output. That will help you identify your problem.

这篇关于使用 WAMP 的虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆