使用nginx搭建https服务器
来源:互联网 发布:淘宝蓝钻是什么意思 编辑:程序博客网 时间:2024/05/16 16:20
http://www.cnblogs.com/tintin1926/archive/2012/07/12/2587311.html
最近在研究nginx,整好遇到一个需求就是希望服务器与客户端之间传输内容是加密的,防止中间监听泄露信息,但是去证书服务商那边申请证书又不合算,因为访问服务器的都是内部人士,所以自己给自己颁发证书,忽略掉浏览器的不信任警报即可。下面是颁发证书和配置过程。
首先确保机器上安装了openssl和openssl-devel
#yum install openssl#yum install openssl-devel
然后就是自己颁发证书给自己
#cd /usr/local/nginx/conf#openssl genrsa -des3 -out server.key 1024#openssl req -new -key server.key -out server.csr#openssl rsa -in server.key -out server_nopwd.key#openssl x509 -req -days 365 -in server.csr -signkey server_nopwd.key -out server.crt
至此证书已经生成完毕,下面就是配置nginx
server { listen 443; ssl on; ssl_certificate /usr/local/nginx/conf/server.crt; ssl_certificate_key /usr/local/nginx/conf/server_nopwd.key;}
然后重启nginx即可。
ps: 如果出现“[emerg] 10464#0: unknown directive "ssl" in /usr/local/nginx-0.6.32/conf/nginx.conf:74”则说明没有将ssl模块编译进nginx,在configure的时候加上“--with-http_ssl_module”即可^^
至此已经完成了https服务器搭建,但如何让浏览器信任自己颁发的证书呢?
今天终于研究捣鼓出来了,只要将之前生成的server.crt文件导入到系统的证书管理器就行了,具体方法:
控制面板 -> Internet选项 -> 内容 -> 发行者 -> 受信任的根证书颁发机构 -> 导入 -》选择server.crt
- 使用nginx搭建https服务器
- 使用nginx搭建https服务器
- 使用nginx搭建https服务器
- 使用nginx搭建https服务器
- 使用nginx搭建https服务器
- 使用nginx搭建https服务器
- 使用nginx搭建https服务器
- 使用nginx搭建https服务器
- 使用 Nginx 搭建 HTTPS 服务器
- 【Nginx】使用nginx搭建https服务器
- centos下使用nginx搭建https服务器
- centos下使用nginx搭建https服务器
- centos使用nginx搭建https服务器
- Nginx搭建HTTPS服务器
- nginx搭建https服务器
- Nginx 搭建 HTTPS 服务器
- nginx搭建https服务器
- nginx搭建https服务器
- git pull 丢失的文件
- C#,将IrisSkin2皮肤完全整合到exe中
- AFNetworking 图片的本地缓存问题
- 线程锁和EnterCriticalSection、LeaveCriticalSection用法
- QT--QSocketNotifier类介绍
- 使用nginx搭建https服务器
- tomcat下设置jvm内存参数
- cocos2dx-按钮操作
- table_open_cache太大引发的问题
- Android Camera API 1.0, 2.0, 3.0 知多少
- Conflict Misses in Direct-Mapped Caches
- CentOS-6.3安装配置Nginx
- AFNetworking 如何POST一个JSON数据到服务器
- STL中关联容器map的用法详解