前言
nginx和httpd的区别我这里不介绍了,同学们自行了解,这篇文章经本人实践总结,希望对你有所帮助。现阶段已经步入了TLS 1.3的时代,所以本次搭建https服务器是支持TLS 1.3协议的。
本篇借鉴了吴昊博客的经验,谢谢!链接(https://blog.whsir.com/post-4967.html)
环境准备
CentOS7版本:
[root@localhost ~]# rpm -q centos-release
centos-release-7-6.1810.2.el7.centos.x86_64
防火墙设置:
防火墙可以关闭也可以开启80和443端口
关闭防火墙:
systemctl stop firewalld.service
不关闭防火墙,但是开启80和443端口
因为之前已设置,所以会提示已经开启。
[root@localhost ~]# firewall-cmd --state
running
[root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
Warning: ALREADY_ENABLED: 80:tcp
success
[root@localhost ~]# firewall-cmd --zone=public --add-port=443/tcp --permanent
Warning: ALREADY_ENABLED: 443:tcp
success
[root@localhost ~]# firewall-cmd --reload
success
下载安装部署环境
第一步
首先下载安装支持nginx的必要环境和依赖
先到主目录下[root@localhost ~]#
执行以下几条命令
[root@localhost ~]# yum install wget
[root@localhost ~]# yum install gcc
[root@localhost ~]# yum install gcc-c++
[root@localhost ~]# yum install pcre-devel
[root@localhost ~]# yum install openssl
[root@localhost ~]# yum install openssl-devel
[root@localhost ~]# yum install zlib
[root@localhost ~]# yum install zlib-devel
[root@localhost ~]# yum install perl-core
第二步
下载Nginx
[root@localhost ~]# cd /usr/local/src
[root@localhost src]# wget http://nginx.org/download/nginx-1.16.1.tar.gz
[root@localhost src]# tar xf nginx-1.16.1.tar.gz
至此我们下载并解压完nginx的安装包,但是先别急着make
第三步
下载OpenSSL
有同学会提问,之前不是通