Nginx安装HTTP SSL模块基本配置
2016-12-27 10:05
260 查看
摘要: 简单实现Nginx反向代理https请求的配置。
wget 192.168.28.74:8080/openssl-1.0.2e.tar.gz
tar -xvf openssl-1.0.2e.tar.gz
cd /opt/server/
wget http://mirrors.sohu.com/nginx/nginx-1.5.1.zip
unzip nginx-1.5.1.zip
nginx默认安装在
/usr/local/目录下,这里指定安装在特定目录下。
按照以上方式自行颁发的SSL证书是不受浏览器信任的。推荐使用受浏览器信任的StartSSL免费SSL证书。
申请地址:https://startssl.com
因为证书颁发给的是junglone.com,所以通过ip访问的时候是有安全提醒。
通过域名访问就可以看到清爽的小图标了。如下图:
一、安装ssl和编译安装nginx
cd /opt/server/wget 192.168.28.74:8080/openssl-1.0.2e.tar.gz
tar -xvf openssl-1.0.2e.tar.gz
cd /opt/server/
wget http://mirrors.sohu.com/nginx/nginx-1.5.1.zip
unzip nginx-1.5.1.zip
[root@bogon nginx-1.6.2]# ./configure --prefix=/opt/server/nginx-1.5.1 --with-http_stub_status_module --with-http_ssl_module --with-openssl=../openssl-1.0.2e/ [root@bogon nginx-1.6.2]# make [root@bogon nginx-1.6.2]# make install
nginx默认安装在
/usr/local/目录下,这里指定安装在特定目录下。
二、生成SSL证书
[root@bogon ssl]# openssl req -new -key junglone.com.key -out junglone.com.csr Enter pass phrase for junglone.com.key: You are about to be asked to enter information that will be incorporated to your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:CN State or Province Name (full name) []:China Locality Name (eg, city) [Default City]:Beijing Organization Name (eg, company) [Default Company Ltd]:junglone.com Organizational Unit Name (eg, section) []:junglone.com Common Name (eg, your name or your server's hostname) []:junglone.com Email Address []:admin@junglone.com Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: [root@bogon ssl]# openssl rsa -in junglone.com.key -out junglone.com_nopass.key Enter pass phrase for junglone.com.key: writing RSA key [root@bogon ssl]# ls junglone.com.csr junglone.com.key junglone.com_nopass.key [root@bogon ssl]# ll 总用量 12 -rw-r--r-- 1 root root 716 7月 22 13:17 junglone.com.csr -rw-r--r-- 1 root root 891 7月 22 13:18 junglone.com.key -rw-r--r-- 1 root root 963 7月 22 13:17 junglone.com_nopass.key [root@bogon ssl]#
按照以上方式自行颁发的SSL证书是不受浏览器信任的。推荐使用受浏览器信任的StartSSL免费SSL证书。
申请地址:https://startssl.com
三、Nginx配置
server { listen 443 ssl; server_name localhost; ssl on; ssl_certificate /usr/local/nginx/ssl/1_junglone.com_bundle.crt; ssl_certificate_key /usr/local/nginx/ssl/junglone.com_nopass.key; ssl_session_timeout 30m; ssl_protocols SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:!EXP:!RC4:!MD5:!DES:!aNull; ssl_prefer_server_ciphers on;
location / { root html; index index.html index.htm; } }
四、验证
因为证书颁发给的是junglone.com,所以通过ip访问的时候是有安全提醒。
通过域名访问就可以看到清爽的小图标了。如下图:
相关文章推荐
- Nginx安装HTTP SSL模块基本配置
- nginx的yum安装,基本参数使用,编译参数说明和Nginx基本配置,模块安装
- 高性能Web服务器Nginx的配置与部署研究(9)核心模块之HTTP模块基本常用指令
- Nginx的配置与部署(9)核心模块之HTTP模块基本常用指令
- Nginx - Windows下Nginx基本安装和配置
- 编译安装配置nginx1.6以及其一些基本配置等
- 高性能Web服务器Nginx的配置与部署研究(9)核心模块之HTTP模块基本常用指令
- nginx详细文档 – 安装配置,深入源码,模块编写,编译器参数,系统函数
- Nginx - Windows下Nginx基本安装和配置
- Debian/Ubuntu下Nginx的安装、反向代理和负载均衡的基本配置
- ubuntu下nginx安装、基本配置及常用命令
- Nginx基本安装配置
- centos nginx基本安装配置
- nginx图片过滤处理模块http_image_filter_module安装配置笔记
- 高性能Web服务器Nginx的配置与部署研究(9)核心模块之HTTP模块基本常用指令
- nginx安装配置+清缓存模块安装
- 源码安装nginx并配置Lua模块
- 源码安装nginx配置Lua模块
- 初识linux之编译安装Nginx以及基本配置
- 一、nginx基本模块以及模块配置