Linux安装nginx并配置https

Linux安装nginx并配置https

第一步:安装下载nginx安装包

# 下载 /usr/local
 wget http://nginx.org/download/nginx-1.15.12.tar.gz
# 解压
tar -zxvf nginx-1.15.12.tar.gz

第二步:编译安装并配置https

# 进入nginx解压后的目录
cd /usr/local/nginx-1.15.12
# 配置ssl模块(默认配置)
./configure --with-http_ssl_module
# 编译
make
# 安装
make install

第三步:检查是否有ssl

# 进入/usr/local/nginx/sbin目录
./nginx -V

显示 configure arguments: --with-http_ssl_module 成功

nginx version: nginx/1.15.12
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) 
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --with-http_ssl_module

第四步:生成ssl证书(介绍生成三种)

生成一个RSA秘钥
[root@localhost ssl]#  openssl genrsa -des3 -out nginx.key 1024  #实际使用中看服务器性能,如果足够好也可以使用4096位秘钥
Generating RSA private key, 1024 bit long modulus
.......++++++
...++++++
e is 65537 (0x10001)
Enter pass phrase for nginx.key:                 #输入密码,自定义,不少于4个字符
Verifying - Enter pass phrase for nginx.key:     #确认密码
生成一个证书请求(三种不同)
第一种: 本地局域网 例如: 192.168.99.122
[root@localhost ssl]# openssl req -new -key nginx.key -out nginx.csr
Enter pass phrase for nginx.key:                             #输入刚刚创建的秘密码
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) [XX]:CN  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码农踩坑之旅

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值