Nginx配置HTTPS

一、Web服务器安装Nginx

1、下载Nginx
https://nginx.org/download/nginx-1.9.4.tar.gz
2、安装依赖
[root@web ~]# yum -y install pcre pcre-devel zlib zlib-devel
[root@web ~]# yum -y install gcc gcc-c++
[root@web ~]# yum install -y openssl openssl-devel
3、安装nginx
[root@web ~]# tar -zxvf nginx-1.9.4.tar.gz
[root@web ~]# cd nginx-1.9.4
[root@web nginx-1.19.4]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module && make && make install
3、编辑nginx配置文件启用https
[root@web ~]# vim /usr/local/nginx/conf/nginx.conf

 

4、复制证书文件到 /usr/local/nginx/conf/目录

[root@web ~]# cp web.* /usr/local/nginx/conf/

5、修改nginx配置文件证书名称

 

 6、启动nginx

[root@web ~]# /usr/local/nginx/sbin/nginx

7、访问验证

 

 

 

posted @ 2020-11-02 09:38  416896401  阅读(1116)  评论(0编辑  收藏  举报