大网数据广告活动
服务器运维问答

Should I care that the "server certificate does NOT include an ID which matches the server name"?

· 52CE 我爱测

I have the following config: <VirtualHost 1.2.3.4:443> ServerName mydomain.com ServerAlias www.mydomain.com ... </VirtualHost> I want www.mydomain.com to be the primary domain, but I also want the user to be able to just type myd…

问题原文

原帖链接 · Quasdunk · CC BY-SA 3.0

I have the following config:

<VirtualHost 1.2.3.4:443>
    ServerName mydomain.com
    ServerAlias www.mydomain.com

    ...
</VirtualHost>

I want www.mydomain.com to be the primary domain, but I also want the user to be able to just type mydomain.com and then I redirect them to www. So the the Certificate Name is www.mydomain.com. But with that I keep getting this warning when starting apache:

AH01909: mydomain.com:443:0 server certificate does NOT include an ID which matches the server name

Everything is working fine though and I also get an A-rating on ssllabs.com. But still this warning bugs me and I'm wondering if I'm maybe missing something here?

Obviously the certificate's CN does not match the Server Name, but it still matches an Alias.

Is this "bad practice" or is there another way to handle this that does not produce this warning? Should I even care about it? In the end it's just a warning that something might be wrong, but it's not. Or could this cause issues on the client side?

So far everything worked fine for me and the users didn't complain, so I guess everything is working correctly.

已采纳解答

原帖链接 · HBruijn · CC BY-SA 3.0

In general the warning "server certificate does NOT include an ID which matches the server name" is a warning (not a fatal error) addressed at the system administrator that they most likely made a configuration error indicating that the wrong TLS server certificate has been set, or at least that Apache httpd can't match the ServerName to the common name or any of subjectAlternateName in the certificate.

In your case simply switching the ServerName and ServerAlias directives will get rid of the startup error.

<VirtualHost 1.2.3.4:443>
    ServerName www.example.com
    ServerAlias example.com

But you might want to get an actual certificate for example.com if it is not included as an Subject Alternate Name entry on the www.example.com certificate.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-11-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。