AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 76766
Accepted
rcampbell
rcampbell
Asked: 2009-10-22 06:41:29 +0800 CST2009-10-22 06:41:29 +0800 CST 2009-10-22 06:41:29 +0800 CST

如何解决 apache2 httpd 错误“不支持使用 NameVirtualHost 地址混合 * 端口和非 * 端口”

  • 772

这是我在启动 Apache2 时遇到的错误:

 * Starting web server apache2
 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 [Wed Oct 21 16:37:26 2009] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
 [Wed Oct 21 16:37:26 2009] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
 [Wed Oct 21 16:37:26 2009] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
 [Wed Oct 21 16:37:26 2009] [error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
 [Wed Oct 21 16:37:26 2009] [warn] NameVirtualHost *:80 has no VirtualHosts

我首先按照本指南设置 Apache 以托管多个站点:

http://www.debian-administration.org/articles/412

然后我在 ServerFault 上发现了一个类似的问题,并尝试应用该解决方案,但没有帮助。

这是我最终的 VirtualHost 配置的示例:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName  www.xxx.com
    ServerAlias xxx.com

    # Indexes + Directory Root.
    DirectoryIndex index.html
    DocumentRoot /var/www/www.xxx.com

    # Logfiles
    ErrorLog  /var/www/www.xxx.com/logs/error.log
    CustomLog /var/www/www.xxx.com/logs/access.log combined
</VirtualHost>

使用域 X 来保护无辜者 :-)

此外,我在指南中提到的conf.d/virtual.conf文件如下所示:

NameVirtualHost *

奇怪的是,这三个站点中的两个站点似乎一切正常。

apache-2.2
  • 4 4 个回答
  • 48688 Views

4 个回答

  • Voted
  1. Best Answer
    joschi
    2009-10-22T07:43:44+08:002009-10-22T07:43:44+08:00

    以 命名的 IP 地址NameVirtualHost必须与每个VirtualHost元素中的 IP 地址相匹配。

    例子:

    NameVirtualHost *:80
    NameVirtualHost *:81
    
    <VirtualHost *:80>
    # ...
    </VirtualHost>
    
    <VirtualHost *:81>
    # ...
    </VirtualHost>
    
    # This will not work!
    <VirtualHost *>
    # ...
    </VirtualHost>
    

    有关详细信息,请阅读Apache 虚拟主机文档。

    • 29
  2. Eric Dennis
    2009-10-22T09:40:11+08:002009-10-22T09:40:11+08:00

    替换这个:

    NameVirtualHost *
    

    有了这个:

    NameVirtualHost *:80
    
    • 13
  3. Rod
    2010-05-22T03:42:18+08:002010-05-22T03:42:18+08:00

    添加到响应中,我注意到的一件事是,如果没有在每个 NameVirtualHost 和 VirtualHost 指令上明确声明 :80 就无法运行 SSL,apache 将不支持:

    名称虚拟主机 *

    和

    名称虚拟主机 *:443

    混合在同一个配置中,如果你这样做,你会在 apache 监听端口 0 时遇到错误。

    对我来说,我只是在每个主机上添加了 :80,以便 SSL 可以正常工作。

    • 5
  4. friv
    2011-09-27T23:13:10+08:002011-09-27T23:13:10+08:00

    前任:

    <VirtualHost 85.25.97.252:80>
    ServerName domain.com
    ServerAlias * .domain.com
    ServerAdmin [email protected]
    DocumentRoot "/var/www/domain.com/httpdocs/"
    <Directory "/var/www/domain.com/ httpdocs/">
    选项索引 FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>

    • 0

相关问题

  • Apache Django Mod_Wsgi - 自动重新加载应用程序

  • Apache:对多个虚拟主机使用相同的目录指令

  • Apache 上的子域不工作 - 找不到服务器

  • PHP 作为 CGI 还是 Apache 模块?

  • 避免将某些丢失的文件记录到 Apache2 错误日志中

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    从 IP 地址解析主机名

    • 8 个回答
  • Marko Smith

    如何按大小对 du -h 输出进行排序

    • 30 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    Windows 中执行反向 DNS 查找的命令行实用程序是什么?

    • 14 个回答
  • Marko Smith

    如何检查 Windows 机器上的端口是否被阻塞?

    • 4 个回答
  • Marko Smith

    我应该打开哪个端口以允许远程桌面?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    MikeN 在 Nginx 中,如何在维护子域的同时将所有 http 请求重写为 https? 2009-09-22 06:04:43 +0800 CST
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    0x89 bash中的双方括号和单方括号有什么区别? 2009-08-10 13:11:51 +0800 CST
  • Martin Hope
    kch 如何更改我的私钥密码? 2009-08-06 21:37:57 +0800 CST
  • Martin Hope
    Kyle Brandt IPv4 子网如何工作? 2009-08-05 06:05:31 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve