nginx系列(五)----使用ssl模块配置https支持
背景
我们在nginx系列(二 )中对nginx进行编译时,添加了ssl模块,所以我们不需要再次添加。如果在之前编译时没有添加,我们现在只需要将原来的内容备份,然后重新编译,在安装时,选择make,最后将编译后的内容覆盖原来的就可以了。
编译的内容为:./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_image_filter_module=dynamic --with-http_ssl_module
配置https
步骤一:cd /usr/local/nginx/conf 中,vim nginx.conf
步骤二:生成自签名证书
cd /etc/pki/tls/certs
make cert.pem
步骤三:建立对应的目录/web ,并写默认发布文件
步骤四:添加本地解析(在物理机上)
步骤五:测试。
在浏览器上输入https,可以查看到相对应的内容
配置https成功!