在Nginx下部署SSL证书并重定向至HTTPS
发布日期:2021-05-12 20:09:45 浏览次数:11 分类:精选文章

本文共 1750 字,大约阅读时间需要 5 分钟。

Nginx SSL ������������������

Step 1��������� Nginx ���������������

��������������������������������� Nginx ��� SSL ������������������������������������������������������������������

  • .key ������
  • .crt ��� .pem ������

Step 2���������������������

������������������������������������������������ /root���������������������������������

  • .crt ��������������� ssl.crt
  • .key ��������������� ssl.key
  • .pem ��������������� ssl.pem

Step 3��������� Nginx ���������

������ LNMP ������������������������ Nginx ������������������������������������������

  • /usr/local/nginx/conf/vhost/.Retrofit ��������������������������������������������� www.yourdomain.com.conf���

��������������� Nginx ������������������ /etc/nginx/nginx.conf��������� VI ���������������������

vi /etc/nginx/nginx.conf

��� server ��������������������� SSL ���������

server {    listen 443;    server_name yourdomain.com; # ���������������������������    ssl on;    root html;    index index.html index.htm;    ssl_certificate /root/ssl.pem;    ssl_certificate_key /root/ssl.key;    ssl_session_timeout 5m;    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;    ssl_prefer_server_ciphers on;    location / {        root html;        index index.html index.htm;    }}

Step 4��������� 301 ������������ HTTPS

��� Nginx ���������������������������������������������������

server {    listen 80;    server_name yourdomain.com; # ���������������������������    rewrite ^/(.*) permanent; # ������������������������ www������������������������ www    # ��� ������������������}

������������������������������ Nginx ���������������������������������

nginx -s reload

���������Nginx ���������������HTTPSinterpretation ���acheck������

上一篇:Tomcat下SSL证书的安装方法
下一篇:Tomcat下的SSL证书安装方法

发表评论

最新留言

留言是一种美德,欢迎回访!
[***.207.175.100]2025年04月21日 15时38分40秒