您的位置:首页 > 理论基础 > 计算机网络

关于服务器ssl配置以后,https无法访问的问题

2012-02-29 12:16 656 查看
通常在项目里,如果要用到ssl的话,一般都是自己先做个免费的证书在开发的过程中用的。等到上线了才去花钱买ssl证书。

这一回,自制了证书,在apache里也配置好后,始终无法通过https访问。调查步骤如下

step1. 确认apache配置。

httpd.conf里,查看mod_ssl.so和httpd-ssl.conf配置。如果没有mod_ssl.so的话,通过apachectrl -l 查看apache是否有内置变异了ssl模块。

httpd-ssl.conf里,查看Listen 443、server.crt、server.key的配置。

step2. apache重启的时候,在error-log里查看有没有错误日志。

到这一步,可以确定配置应该没什么问题。

step3. 在服务器里,通过命令 netstat -ano 确定443端口被监听

step4. 本地通过命令 telnet www.xxxx.com 80 和 telnet www.xxxx.com 443 , 发觉80端口能访问,443端口访问不了。

step5. 在服务器里通过命令 wget http://www.xxx.com/ 和 wget https://www.xxxx.com/,同样发觉80端口能连接的上,443端口连接不上。
Resolving staging.shop.connectingcard.com... xxx.xxx.xxx.xx
Connecting to www.xxxx.com|xxx.xxx.xxx.xx|:80... connected.
...


Resolving www.xxxx.com... xxx.xxx.xxx.xx
Connecting to www.xxxx.com|xxx.xxx.xxx.xx|:443...


到这一步,可以确定应该是443端口访问不了的原因。

step 6. 查看服务器的iptables,确定443没有禁止访问。

step 7. 在服务器,使用wget命令,通过本地IP访问

wget https://xxx.xxx.xxx.xx/,得到如下结果
--2012-02-29 11:21:05--  https://xxx.xxx.xxx.xx/ Connecting to xxx.xxx.xxx.xx:443... connected.
ERROR: cannot verify xxx.xxx.xxx.xx's certificate, issued by `/C=JP/ST=oosaka/L=oosaka/O=oosaka/OU=oosaka/CN=www.xxxx.com':
Self-signed certificate encountered.
ERROR: certificate common name `www.xxxx.com' doesn't match requested host name `xxx.xxx.xxx.xx'.
To connect to xxx.xxx.xxx.xx insecurely, use `--no-check-certificate'.
Unable to establish SSL connection.


在使用命令 wget --no-check-certificate https://xxx.xxx.xxx.xx/ 访问,得到页面内容。

到这一步可以确定,服务器本身的443端口是开放的,只是从外部无法通过443端口访问服务器。

那么,问题可能是,服务器的网络环境中,防火墙的配置里没有对外开放服务器这台机子的443端口。

解决问题的话需要需要服务器网络管理人员配合。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐