NameVirtualHost 0.0.0.0:80没有VirtualHosts

 墨镜小辣妹 发布于 2023-02-10 13:13

我的服务器运行正常,但有些东西改变了,我不确定是什么.

我收到以下错误,无法获得某些子域名.

apache2: Could not reliably determine the server's fully qualified domain name, using     2001:.....:a669 for ServerName
[Sat Dec 14 21:20:36 2013] [warn] NameVirtualHost 0.0.0.0:80 has no VirtualHosts
...
[Sat Dec 14 21:20:36 2013] [warn] NameVirtualHost 0.0.0.0:80 has no VirtualHosts
Syntax OK

我已经尝试将ports.conf更改为Listen 80和Listen 0.0.0.0:80(参见http://www.rackaid.com/resources/how-to-disable-ipv6-in-apache-server/)

这是我的一个vhost文件.

NameVirtualHost 0.0.0.0:80
Listen 0.0.0.0:80

    ServerName www.domain.us
    ServerAlias domain.us
    ServerAdmin email@domain.us

    DocumentRoot /home/valid_domain_path/www
    
            Options FollowSymLinks
            AllowOverride None
    
    
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    

    ErrorLog ${APACHE_LOG_DIR}/www.domain.us.error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel info

    CustomLog ${APACHE_LOG_DIR}/www.domain.us.access.log combined

000默认链接正确.

Apache 2.2.22

谢谢,

1 个回答
  • 如果我的怀疑是正确的,并且您的系统最近已经更新,那么您现在使用Apache 2.4而不是2.2,就像许多其他用户刚刚(已)转移到新的Ubuntu 13.10版本一样.(如果您尚未更改为Apache 2.4,那么现在可能是更新新的*.conf文件的好时机.)

    以下是关于如何使基于命名的VirtualHosts在Apache 2.4中工作的非常好的解释:http: //httpd.apache.org/docs/2.4/vhosts/name-based.html

    在本质上:

      从现在开始不要使用任何"NameVirtualHost"条目

      像这样启动所有VirtualHost条目 <VirtualHost *:80>

      确保在每个VirtualHost条目中只包含一个ServerName,例如. ServerName www.example.com

    最后它应该是这样的:

    <VirtualHost *:80>
        # This first-listed virtual host is also the default for *:80
        ServerName www.example.com
        ServerAlias example.com 
        DocumentRoot /www/domain
    </VirtualHost>
    
    <VirtualHost *:80>
        ServerName other.example.com
        DocumentRoot /www/otherdomain
    </VirtualHost>
    

    2023-02-10 13:14 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有