1.查看是否已经安装 ssl 组件

[root@localhost wwwlogs]# cd /usr/local/nginx/sbin/
[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.0.15
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-52)
TLS SNI support disabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6
如果已经有了 http_ssl_module 则表示已经安装.若没有, 则要重新编译一安装 nginx
 
2.生成 key
[root@localhost sbin]# cd /usr/local/nginx/conf/
[root@localhost conf]# openssl genrsa -des3 -out server.key 1024
Generating RSA private key, 1024 bit long modulus
.......++++++
..........................................++++++
e is 65537 (0x10001)
Enter pass phrase for server.key:abcd
Verifying - Enter pass phrase for server.key:abcd
 
3.生成证书
[root@localhost conf]# openssl req -new -key server.key -out server.csr
Enter pass phrase for server.key:abcd
You are about to be asked to enter information that will be incorporated
into 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) [GB]:CN
State or Province Name (full name) [Berkshire]:beijing
Locality Name (eg, city) [Newbury]:chaoyang
Organization Name (eg, company) [My Company Ltd]:test
Organizational Unit Name (eg, section) []:web
Common Name (eg, your name or your server's hostname) []:sunyu
Email Address []:sunyu@test.cn
 
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:1qazxsw23edc
An optional company name []:testcomp
 
[root@localhost conf]# cp server.key server.key.org
[root@localhost conf]# openssl rsa -in server.key.org -out server.key
Enter pass phrase for server.key.org:abcd
writing RSA key
[root@localhost conf]# openssl x509 -req -days 365 -in server.csr -signkey server.key -outserver.crt
Signature ok
subject=/C=CN/ST=beijing/L=chaoyang/O=easymobi/OU=web/CN=sunyu/emailAddress=sunyu@easymobi.cn
Getting Private key
 
4.配置 nginx
在配置文件中加入:
server
{
listen       443;
server_name test.test.cn;
index index.html index.htm index.php;
root  /home/wwwroot/vegtest/;
 
ssl on;
ssl_certificate /usr/local/nginx/conf/server.crt;
ssl_certificate_key /usr/local/nginx/conf/server.key;
}
然后访问 https://test.test.cn 即可看到效果.

centos nginx install openssl的更多相关文章

  1. Centos7 编译安装 Nginx Mariadb Asp.net Core2 (实测 笔记 Centos 7.3 + Openssl 1.1.0h + Mariadb 10.3.7 + Nginx 1.14.0 + Asp.net. Core 2 )

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...

  2. Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Openssl 1.1.0e + Mariadb 10.1.22 + Nginx 1.12.0 + PHP 7.1.4 + Laravel 5.4 )

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...

  3. CentOS 6.6 nginx install

    /************************************************************************* * CentOS 6.6 nginx instal ...

  4. nginx反向代理cas-server之2:生成证书,centOS下使用openssl生成CA证书(根证书、server证书、client证书)

    前些天搭好了cas系统,这几天一致再搞nginx和cas的反向代理,一直不成功,但是走http还是测试通过的,最终确定是ssl认证证书这一块的问题,原本我在cas服务端里的tomcat已经配置了证书, ...

  5. centos+nginx从零开始配置负载均衡

    nginx负载均衡的理解 nginx是一个轻量级的.高性能的webserver,他主要可以干下面两件事: 作为http服务器(和apache的效果一样) 作为反向代理服务器实现负载均衡 现在nginx ...

  6. CentOS+Nginx一步一步开始配置负载均衡

    Nginx负载均衡的理解 http://www.linuxdiyf.com/linux/10205.html Nginx是一个轻量级的.高性能的WebServer,他主要可以干下面两件事: 作为htt ...

  7. Nginx Install 记录

    一.安装编译工具及库文件 yum -y install gcc yum -y install gcc-c++ yum -y install zlib; yum -y install pcre-deve ...

  8. CentOS+Nginx+PHP 前端部署

    都说Nginx比Apache性能优越,一直没有时间装测试,今天终于有时间装上试试性能了,其实Nginx的安装非常简单,具体流水步骤记录如下: 1.系统环境: ===================== ...

  9. Cacti监控服务器配置教程(基于CentOS+Nginx+MySQL+PHP环境搭建)

    Cacti监控服务器配置教程(基于CentOS+Nginx+MySQL+PHP环境搭建) 具体案例:局域网内有两台主机,一台Linux.一台Windows,现在需要配置一台Cacti监控服务器对这两台 ...

随机推荐

  1. ****Objective-C 中的方法的调用

    oc语言中采用特定的语言调用类或者实例(对象)的方法称为发送消息或者方法调用. oc中方法的调用有两种: 第一种: [类名或对象名 方法名]; [ClassOrInstance method]; [C ...

  2. android 发送自定义广播以及接收自定义广播

    发送自定义广播程序: 布局文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout x ...

  3. [dp]POJ2559 && HDOJ1506 Largest Rectangle in a Histogram

    题意 给n个条形的高度, 问能放的最大矩形面积 分析: 从左到右 从右到左 各搞一遍 分别记录      L[i]记录列(从前往后)标 第几列开始 可以往后放高度为a[i]的矩形  R[i]记录列(从 ...

  4. [codility]Falling-discs

    http://codility.com/demo/take-sample-test/omega2013 这题有点意思.首先经过思考,想到从底部往上扫,去迎接掉下来的disc.但这样仍然是不行的.后来看 ...

  5. jav利用反射修改类的静态变量

    有Student这个类: public class Student { private static String schoolName=""; private static St ...

  6. SPRING IN ACTION 第4版笔记-第三章ADVANCING WIRING-008-SpEL介绍

    一. 1.SpEL expressions are framed with  #{ ... } 2.SpEl的作用 Sp EL has a lot of tricks up its sleeves, ...

  7. [Hadoop源码解读](四)MapReduce篇之Counter相关类

    当我们定义一个Counter时,我们首先要定义一枚举类型: public static enum MY_COUNTER{ CORRUPTED_DATA_COUNTER, NORMAL_DATA_COU ...

  8. MapReduce架构设计

    MapReduce采用Master/Slave的架构,其架构图如下: 它主要有以下4个部分组成: 1)Client 2)JobTracker JobTracke负责资源监控和作业调度.JobTrack ...

  9. 六月计划#2B(6.10-6.16)

    4/7 STL set 数学 快速傅立叶(FFT) 高斯消元 动态规划 斜率优化

  10. [转] Java之ACM速成

    转载自:http://blog.csdn.net/skiffloveblue/article/details/7032290 相关题目:POJ 1131 1205 1220 1405 1503 160 ...