Nginx Https配置
2020-04-22 04:16
543 查看
Nginx 配置 https
Let’s Encrypt 安装
- git clone https://github.com/letsencrypt/letsencrypt(如果你嫌麻烦资源见文末直接下载解压操作)
- cd letsencrypt
- ./certbot-auto certonly --standalone --email 你的邮箱 -d 你的域名
- Could not bind to IPv4 or IPv6.软件安装报错
1. service nginx stop
2. 执行步骤3
3. service nginx start
Let’s Encrypt 证书续签
- crontab -e
- 0 */12 * * * certbot renew --quiet --renew-hook “/etc/init.d/nginx reload”
- 以上为每天自动续签两次
Https 脚本配置
- 脚本
# HTTPS server # server { listen 443 ssl; server_name localhost; root /var/www/html; #证书位置 ssl_certificate /etc/letsencrypt/live/www.***.com/fullchain.pem; # 路径为证书生成的路径 ssl_certificate_key /etc/letsencrypt/live/www.***.com/privkey.pem; # 路径为证书生成的路径 ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; #协议配置 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; # 转发到http 根据自己项目配置转发规则 location /sys/staff/ { proxy_pass http://localhost:8080; } location /api/ { proxy_pass http://localhost:8080; } location /webChat/ { proxy_pass http://localhost:8080; } location /weChat/ { proxy_pass http://localhost:8080; } }
- nginx -s reload :修改配置后重新加载生效
Https 测试
- /var/www/html 下新建文本helloword.txt
- 浏览器访问 如果能访问表示配置成功
相关资源
- https://download.csdn.net/download/u011337378/12280370
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- nginx https配置演示 简单可用
- 【IDEA】IDEA配置maven
- 配置文件nginx.conf中的max_clients影响因素
- resin4 配置多个app实例 转
- nginx环境下配置nagios-关于start_perl_cgi.sh
- 如何正确配置Nginx+PHP
- MyBatis学习 之 一、MyBatis简介与配置MyBatis+Spring+MySql
- Hadoop集群(第5期)_Hadoop安装配置
- TX_SDK开发的配置
- ubuntu常用工具及环境配置
- java环境变量配置
- httpd.conf配置文件总结
- CentOS 7 Linux下配置Oracle 11gR2为系统服务自动启动
- tomcat 热部署和热加载 配置
- mysql-5.5 ---配置文件参数说明
- workerman配置过程遇到的问题
- nginx配置文件中的location中文详解
- Windows下JAVA/Android开发环境配置
- H3C 配置SNMP
- 客房收费制度的具体配置