Apache VirtualHost 无法工作(Wamp/Win7)
我拥有两个域,我想将它们指向我家中的本地服务器:
- www.first.com
- www.second.com
它们都指向我家中自己的服务器(是的,我已经在以下位置管理了 A 记录配置)我注册域名的网络酒店)。
我已完成以下操作:
- 在 httpd.conf 中,我取消注释了
Include conf/extra/httpd-vhosts.conf
行 在 httpd-vhosts.conf 中,我有以下代码:
NameVirtualHost *:80 <虚拟主机 *:80> 服务器名称first.com 服务器别名 www.first.com 文档根目录“C:/wamp/www/public/first” <虚拟主机 *:80> 服务器名称 secondary.com 服务器别名 www.second.com 文档根目录“C:/wamp/www/public/second”
- 在 httpd.conf 文件中,我将 document-root 设置为
C:\wamp\www\public
,这是我最不确定的一步。当 httpd-vhosts.conf 文件声明多个文档根时,httpd.conf 文件中的文档根应该是什么?我尝试将 httpd.conf 的文档根设置为C:/wamp/www/public
并且仅设置为C:/wamp/www/
我缺少什么这里?页面根本不会加载。
I own two domains which I want to point to my local server here at home:
- www.first.com
- www.second.com
They both point to my own server here at home (Yes I've already managed the A-record config at my webhotel where I registered the domains).
I've done the following:
- In httpd.conf, I've uncommented the line
Include conf/extra/httpd-vhosts.conf
In httpd-vhosts.conf I have the following code:
NameVirtualHost *:80 <VirtualHost *:80> ServerName first.com ServerAlias www.first.com DocumentRoot "C:/wamp/www/public/first" </VirtualHost> <VirtualHost *:80> ServerName second.com ServerAlias www.second.com DocumentRoot "C:/wamp/www/public/second" </VirtualHost>
- In the httpd.conf file, I've set document-root to
C:\wamp\www\public
, and this is the step I'm most uncertain of. What should the document root be in the httpd.conf file when the httpd-vhosts.conf file declares multiple document roots? I've tried to set the document root of httpd.conf to bothC:/wamp/www/public
and onlyC:/wamp/www/
What am I missing here? The pages won't load at all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一旦您定义了 Virthosts,“主”服务器的 DocumentRoot 就不再有意义 - 已知的 virthosts 将从其定义中提供服务,未知 - 由列表中的第一个 virthost
为每个 virthost 创建单独的日志文件,是的,在访问尝试后检查日志
这是错误的错误描述。您收到哪个错误代码?您在 virthost 根目录中有 DirectoryIndex 和索引文件吗?目录位置的允许/禁止指令怎么样?
DocumentRoot for "main" server haven't sense as soon as you define Virthosts - known virthosts will be served from their definition, unknown - by first virthost in list
Create separate log-files per virthost and yes, check logs after access attept
It's bad error-description. Which error-code you get? Do you have DirectoryIndex and index-file in virthost root? What about Allow/Disallow directives for Directory locations?