<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[网站不能访问是SSL证书到期了？]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Sun, 21 Feb 2016 03:58:17 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	1. 现象<br/>放假期间收到zabbix报警，提示主站访问不了，报502。<br/><br/>2.排查思路及过程<br/>因为是过年休息，放假前又没有更新，基本可以排除是更新和配置导致的问题。ssh连上服务器发现服务器连接和资源都没问题。这是一套lnamp架构的网站，就是nginx反向代理到Apache，所以考虑是Apache的问题，于是重启httpd服务。<br/><br/>重启httpd服务的时候启动失败，没有看到错误，所以去查看日志文件，看到如下报错：<br/>tail -200 /var/log/httpd/error_log<br/><br/>[TIME 2016] [error] SSL Library Error: -8181 Certificate has expired<br/>[TIME 2016] [error] Unable to verify certificate &#039;Server-Cert&#039;. Add &quot;NSSEnforceValidCerts off&quot; to nss.conf so the server can start until the problem can be resolved.<br/>可以看到是证书过期了，并且给出了一种解决方法是添加‘NSSEnforceValidCerts off’到nss.conf服务器就可以启动，就是不验证证书过期时间。<br/><br/>Apache是用https需要mod_nss的模块支持，我的理解就是使用https需要安装mod_nss，下面给一个官方说明：<br/>&nbsp;&nbsp; The mod_nss module provides strong cryptography for the Apache Web server via the Secure Sockets Layer (SSL) and Transport Layer Security (TLS) protocols using the Network Security Services (NSS) security library.<br/><br/>我的解决方法是重新生成新的证书<br/>cd /etc/httpd/alias<br/>#删除旧的证书<br/>rm -f *.db<br/>#创建新证书<br/>/usr/sbin/gencert /etc/httpd/alias &gt; /etc/httpd/alias/install.log 2&gt;&amp;1<br/>#查看证书信息<br/>certutil -d /etc/httpd/alias -L -n Server-Cert<br/>Certificate:<br/>Data:<br/>&nbsp;&nbsp;&nbsp;&nbsp;Version: 3 (0x2)<br/>&nbsp;&nbsp;&nbsp;&nbsp;Serial Number: 3 (0x3)<br/>&nbsp;&nbsp;&nbsp;&nbsp;Signature Algorithm: PKCS #1 SHA-1 With RSA Encryption<br/>&nbsp;&nbsp;&nbsp;&nbsp;Issuer: &quot;CN=Certificate Shack,O=example.com,C=US&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;Validity:<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Not Before: Mon Feb 15 02:05:10 2016<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Not After : Sat Feb 15 02:05:10 2020<br/>现在可以看到证书的有效期是4年，新生成的证书到2020年过期。httpd服务可以正常启动。<br/><br/>启动httpd服务后发现首页还是不能访问，可以确认服务都正常启动配置没有问题。继续查看httpd的错误日志发现了新的报错：<br/>[TIME 2016] [error] SSL Library Error: -8038 SEC&#92;_ERROR&#92;_NOT&#92;_INITIALIZED&nbsp;&nbsp;<br/>[TIME 2016] [error] NSS_Initialize failed. Certificate database: /etc/httpd/alias.<br/><br/>百度了下发现是权限问题，重新授下权搞定。<br/>chown root.apache /etc/httpd/alias/*.db<br/>chmod 0640 /etc/httpd/alias/*.db<br/><br/>摘自解决一次由于SSL证书到期导致的网站不能访问的问题（Nginx，php，Apache）：http://branguo.blog.51cto.com/9768383/1742157
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] 网站不能访问是SSL证书到期了？]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>