在局域网内实现https安全访问
准备原料
服务器 resin (当然也可以是tomcat,这里以resin为例)
安装jdk
域名 (随便写一个就行,因为是内网使用,不会被校验)
生成证书
- 第一步:为服务器生成证书
- 第二步:为客户端生成证书
- 第三步:让服务器信任客户端证书
- 第四步:让客户端信任服务器证书
注意:当提示:您的名字与姓氏是什么? 请输入你准备的域名比如:www.aclululu.com
其他的按照提示输入就是了,最后会得到四个文件如下:
生成客户端安装证书
- 双击server.cer文件,按默认安装,直到安装成功
- 打开IE浏览器,找到证书
- 选择导出,导出的证书即可用于其他客户进行安装使用。这里命名为aclululu_client
配置服务器端resin
早期的版本,因为没有最新的,所以请见谅!
resin.conf文件具体需要修改的地方
- 配置https证书
- 配置更新
- 配置httpOnly请求
- 配置secure属性
客户机安装证书,修改host文件(注意客户机)
打开IE浏览器,导入证书
按照默认导入刚刚保存的aclululu_client证书。直到导入成功。
修改host文件
假如服务器的ip为:172.16.1.123
方法一:
修改批处理文件:aclululu_host.bat
@echo off
color 0F
@attrib -r "%windir%\system32\drivers\etc\hosts"
@echo= >>"%windir%\system32\drivers\etc\hosts"
@echo= >>"%windir%\system32\drivers\etc\hosts"
@echo #Fssoft Start >>"%windir%\system32\drivers\etc\hosts"
@echo 172.16.1.123 www.aclululu.com>>"%windir%\system32\drivers\etc\hosts"
@echo #Fssoft End >>"%windir%\system32\drivers\etc\hosts"
@echo= >>"%windir%\system32\drivers\etc\hosts"
@echo= >>"%windir%\system32\drivers\etc\hosts"
@attrib +r "%windir%\system32\drivers\etc\hosts"
然后双击执行bat即可
方法二:
直接去
C:\Windows\System32\drivers\etc下手动修改
访问
https
就可以安全访问172.16.1.123这台主机上的网页了
龙腾一族至尊龙骑