Rootop 服务器运维与web架构

[warn] NameVirtualHost 1.1.1.2:80 has no VirtualHosts

| 暂无评论

[warn] NameVirtualHost 1.1.1.2:80 has no VirtualHosts

在阿帕奇中配置的虚拟主机,重启服务的时候报以上的错误。

配置文件如下:

NameVirtualHost 1.1.1.2:80
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#

<VirtualHost www2.dz.com:80>
Serveradmin
venuslinux@gmail.com
Servername www2.dz.com
Documentroot /wz/dz
Errorlog logs/error_log
Customlog logs/access_log common
Directoryindex index.php
</VirtualHost>

网上搜索的结果大多都是因为namevirtualhost 配置了多遍,导致的错误,但是我就配置了一次。

然后有一条解决方法还靠谱,屏蔽这一行试试,结果可以,但是郁闷中,这是为啥子呢?

随后用dig解析www2.dz.com 随后发现忘记配置dns,加上后,然后又解除namevirtualhost屏蔽后,重启OK了。原来是因为阿帕奇重启的时候会去查询虚拟主机的信息,因为是基于域名的虚拟主机嘛。

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/231.html

作者:Venus

服务器运维与性能优化

发表回复