美文网首页
使用Nginx配置HTTPS域名证书

使用Nginx配置HTTPS域名证书

作者: 书写只为分享 | 来源:发表于2020-10-30 21:48 被阅读0次

1. 安装****SSL模块

要在nginx中配置https,就必须安装ssl模块,也就是: http_ssl_module 。

进入到nginx的解压目录: /home/software/nginx-1.16.1

新增ssl模块(原来的那些模块需要保留)

./configure \

--prefix=/usr/local/nginx \

--pid-path=/var/run/nginx/nginx.pid \

--lock-path=/var/lock/nginx.lock \

--error-log-path=/var/log/nginx/error.log \

--http-log-path=/var/log/nginx/access.log \

--with-http_gzip_static_module \

--http-client-body-temp-path=/var/temp/nginx/client \

--http-proxy-temp-path=/var/temp/nginx/proxy \

--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \

--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \

--http-scgi-temp-path=/var/temp/nginx/scgi \

--with-http_ssl_module

编译和安装

make

make install

2. 配置HTTPS

把ssl证书 *.crt 和 私钥 *.key 拷贝到 /usr/local/nginx/conf 目录中。

新增server 监听443 端口:

server {

listen 443;

server_name www.imoocdsp.com;

开启ssl

ssl on;

配置ssl证书

ssl_certificate 1_www.imoocdsp.com_bundle.crt;

配置证书秘钥

ssl_certificate_key 2_www.imoocdsp.com.key;

ssl会话cache

ssl_session_cache shared:SSL:1m;

ssl会话超时时间

ssl_session_timeout 5m;

配置加密套件,写法遵循 openssl 标准

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;

ssl_prefer_server_ciphers on;

location / {

proxy_pass <u>http://tomcats/;</u>

}

相关文章

  • Nginx 配置 HTTPS

    使用Nginx配置HTTPS域名证书 安装SSL模块要在 nginx 中配置 https,就必须安装 ssl 模块...

  • 使用Nginx配置HTTPS域名证书

    1. 安装****SSL模块 要在nginx中配置https,就必须安装ssl模块,也就是: http_ssl_m...

  • # nginx https证书配置

    nginx https证书配置 一 前言 此文档针对于nginx配置反向代理使用https证书方法 nginx作为...

  • Nginx或tomcat8配置https

    前提申请免费域名https证书 一、nginx配置https并转发到tomcat 1、Nginx配置文件 2、 n...

  • Nginx环境下http和https(ssl)共存的方法

    给nginx配置SSL证书后(这里使用的是自己生成的测试证书,参见 nginx使用ssl模块配置HTTPS支持),...

  • docker | nginx泛域名解析如何配置

    概述 泛域名解析SSL证书需要购买支持泛域名类型的证书 nginx配置文件也需要支持泛域名解析 nginx配置文件...

  • autocert 与 nginx的配合

    autocert 负责生成SSL证书, 生成的证书配置在nginx中, nginx负责处理https请求. 使用a...

  • 开启全站HTTPS时代-Nginx SSL+tomcat集群

    目录:1、凭证申请 Let’s Encrypt2、Nginx支持多域名ssl证书3、Nginx强制使用https访...

  • Nginx配置Https

    场景 公司网站需要使用https访问,域名由运维进行IP关联,因此我们需要做的就是配置nginx证书及跳转。 执行...

  • nginx

    node 使用 nginx 反向代理搭建https服务 使用自己生成的证书 nginx http配置 编辑ngin...

网友评论

      本文标题:使用Nginx配置HTTPS域名证书

      本文链接:https://www.haomeiwen.com/subject/unljvktx.html