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 / 问题 / 486264
Accepted
user35042
user35042
Asked: 2013-03-10 07:23:47 +0800 CST2013-03-10 07:23:47 +0800 CST 2013-03-10 07:23:47 +0800 CST

NameVirtualHost *:443 在 debian squeeze 上没有 VirtualHosts

  • 772

我有一台可以工作的 Apache 2.2 服务器,但NameVirtualHost *:443 has no VirtualHosts在重新启动时收到警告。但我确实有匹配的 VirtualHosts *:443。

系统是Debian压榨的。该ports.conf文件如下所示:

NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
   NameVirtualHost *:443
   Listen 443
</IfModule>

-S这是使用 apache2ctl运行该选项时的输出:

% /usr/sbin/apache2ctl -S 
[Sat Mar 06 10:07:11 2013] [warn] NameVirtualHost *:443 has no VirtualHosts
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:443                  is a NameVirtualHost
         default server q2a-dev.example.org (/etc/apache2/sites-enabled/q2a:1)
         port 443 namevhost q2a-dev.example.org (/etc/apache2/sites-enabled/q2a:1)
         port 443 namevhost tcert-dev.example.org (/etc/apache2/sites-enabled/tcert-dev:1)
*:80                   is a NameVirtualHost
         default server emailtest-dev.example.org (/etc/apache2/sites-enabled/emailtest:1)
         port 80 namevhost emailtest-dev.example.org (/etc/apache2/sites-enabled/emailtest:1)
Syntax OK

这两个虚拟主机在位于以下位置的文件中定义/etc/apache2/sites-enabled:

# /etc/apache2/sites-enabled/q2a
<VirtualHost *:443>
  DocumentRoot /usr/share/question2answer
  ServerName q2a-dev.example.org
  ServerAlias q2a-dev

  SSLEngine on
  SSLCertificateFile /etc/ssl/certs/q2a-dev.pem
  SSLCertificateKeyFile /etc/ssl/private/q2a-dev.key

  DirectoryIndex index.php
</VirtualHost>

这是另一个:

# /etc/apache2/sites-enabled/tcert-dev
<VirtualHost *:443>
  DocumentRoot /srv/www/tools
  ServerName tcert-dev.example.org
  ServerAlias tcert-dev

  SSLEngine on
  SSLCertificateFile /etc/ssl/certs/tcert-dev.pem
  SSLCertificateKeyFile /etc/ssl/private/tcert-dev.key

  <Directory "/">
    AllowOverride None
  </Directory>
</VirtualHost>

apache-2.2
  • 3 3 个回答
  • 37573 Views

3 个回答

  • Voted
  1. Best Answer
    user35042
    2013-03-11T06:53:58+08:002013-03-11T06:53:58+08:00

    我发现了问题。NameVirtualHost *:443在 Andrew B 建议在 pastebin 上发布更多配置后,我更仔细地查看了所有文件,发现指令出现在两个地方:一个在ports.conf目录中的文件中,一个在目录中的文件中,/etc/apache2/conf.d所有文件在 Apache 启动期间加载-向上。

    我删除了其中一个实例,警告消失了。

    (请注意,这整个问题在 Apache 2.4 中消失了,NameVirtualHost因为地址/端口组合出现在多个虚拟主机中是隐含的。)

    • 7
  2. user163807
    2013-03-11T06:14:34+08:002013-03-11T06:14:34+08:00

    我也使用 Debian Squeeze,请看下面我的ports.conf样子。

    注释来自默认文件,注意是你加NameVirtualHost *:443的,我没有加。

    NameVirtualHost *:80
    Listen 80
    
    <IfModule mod_ssl.c>
        # If you add NameVirtualHost *:443 here, you will also have to change
        # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
        # to <VirtualHost *:443>
        # Server Name Indication for SSL named virtual hosts is currently not
        # supported by MSIE on Windows XP.
        Listen 443
    </IfModule>
    
    <IfModule mod_gnutls.c>
        Listen 443
    </IfModule>
    

    注意:如果你喜欢保留NameVirtualHost *:443,ports.conf那么你应该添加一个链接,以便为 443 提供默认的 VirtualHost,如下所示:

    ln -s /etc/apache2/sites-available/default-ssl /etc/apache2/sites-enabled/000-default-ssl
    

    然后我会/etc/apache2/sites-enabled/q2a通过添加来更新<Directory>...</Directory>(这是你放置一些选项的地方,我通过添加一些示例来完成你的代码)。

    <VirtualHost *:443>
      DocumentRoot /usr/share/question2answer
      ServerName q2a-dev.example.org
      ServerAlias q2a-dev
    
      SSLEngine on
      SSLCertificateFile /etc/ssl/certs/q2a-dev.pem
      SSLCertificateKeyFile /etc/ssl/private/q2a-dev.key
    
      <Directory /usr/share/question2answer>
        DirectoryIndex index.php
    
        # here you can also add some other options like:
        Options -Indexes FollowSymLinks MultiViews
        Order deny,allow
        Allow from all
        AllowOverride All
      </Directory>
    </VirtualHost>
    

    最后,我将/etc/apache2/sites-enabled/tcert-dev通过更新<Directory>...</Directory>.

    <VirtualHost *:443>
      DocumentRoot /srv/www/tools
      ServerName tcert-dev.example.org
      ServerAlias tcert-dev
    
      SSLEngine on
      SSLCertificateFile /etc/ssl/certs/tcert-dev.pem
      SSLCertificateKeyFile /etc/ssl/private/tcert-dev.key
    
      <Directory /srv/www/tools>
        AllowOverride None
      </Directory>
    </VirtualHost>
    

    我希望它有所帮助。

    • 1
  3. Mike
    2013-03-10T07:54:48+08:002013-03-10T07:54:48+08:00

    这是一条警告,表示没有为 *:443 设置虚拟主机

    它看起来像

    <virtualhost *:443>
    
    </virtualhost>
    

    如果它不匹配 *:443 那么它将抛出该警告。

    • 0

相关问题

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

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

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

  • PHP 作为 CGI 还是 Apache 模块?

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

Sidebar

Stats

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

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

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

    • 9 个回答
  • Marko Smith

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

    • 3 个回答
  • Marko Smith

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

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +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