Nginx配置https

记录一下实验室测试版服务器的https配置流程,本次为http升级至https

原有的http配置:

server {listen       8001;server_name    localhost;#set $live_status 0           #直播是否开启,初始值为0,关闭location / {root  /home;index index.html  index.html;}location /live {flv_live on;chunked_transfer_encoding on;add_header 'Access-Control-ALLow-Origin' '*';add_header 'Access-Control-Allow-Credentials' 'true';}error_page      500 502 503 504     /50x.html;location = /50x.html{root    html;}}

要想升级为https需要在nginx配置一个代理,就是反向代理类似的操作

同时需要添加安全证书的路径,更改后如下:(参考:/usr/local/openresty/nginx/conf/nginx.conf)

server {listen       8002 ssl;listen     8001;server_name    live;server_name live.test.tinylink.cn;#set $live_status 0          #直播是否开启,初始值为0,关闭#ssl_certificate /root/.acme.sh/*.test.tinylink.cn/fullchain.cer;#ssl_certificate_key /root/.acme.sh/*.test.tinylink.cn/*.test.tinylink.cn.key;ssl_certificate /etc/letsencrypt/live/api.test.tinylink.cn/fullchain.pem;ssl_certificate_key /etc/letsencrypt/live/api.test.tinylink.cn/privkey.pem;ssl_session_timeout 5m;ssl_session_cache shared:SSL:50m;ssl_protocols TLSv1 TLSv1.1 TLSv1.2 SSLv3;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;client_max_body_size 500M;client_body_buffer_size 500M;location / {proxy_pass http://localhost:8001/;proxy_set_header Host $host:$server_port;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_redirect off;#proxy_set_header Upgrade $http_upgrade;#proxy_set_header Connection "upgrade";}location /live {flv_live on;chunked_transfer_encoding on;add_header 'Access-Control-ALLow-Origin' '*';add_header 'Access-Control-Allow-Credentials' 'true';}error_page        500 502 503 504     /50x.html;location = /50x.html{root    html;}}

之后去配置frpc,位置在:/root/yangg/frp/configs/frp/frpc.ini

[http_linklab_test_api_live_https]
type = https
custom_domains = live.test.tinylink.cnplugin = https2http
plugin_local_addr = 127.0.0.1:8001plugin_crt_path = /root/.acme.sh/*.test.tinylink.cn/fullchain.cer
plugin_key_path = /root/.acme.sh/*.test.tinylink.cn/*.test.tinylink.cn.key
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp

之后重启frpc服务:

$ systemctl restart frpc-http.service
$ openresty -s reload

Nginx配置http升级https相关推荐

  1. 使用 Caddy 替代 Nginx,全站升级 https,配置更加简单

    使用 Caddy 替代 Nginx,全站升级 https,配置更加简单 Caddy 是什么? Caddy 是一个多功能的 HTTP web服务器,并且使用Let's Encrypt提供的免费证书,自动 ...

  2. nginx配置http、https访问,nginx指定ssl证书,阿里云腾讯云华为云设置nginx https安全访问

    nginx配置http.https访问 要设置https访问需要从对应的云厂商申请证书,并下载Nginx证书到服务器. 我这里从阿里云申请了免费的域名证书,然后将证书放置在服务器的/etc/ssl/. ...

  3. nginx配置ssl实现https访问 亲测有效

    nginx配置ssl实现https访问 亲测有效 申请证书 运行用户,默认即是nginx,可以不进行设置 停止nginx 启动 nginx日常操作命令 申请证书 在这里,我直接申请腾讯云的免费证书.这 ...

  4. Linux下nginx配置证书实现https访问

    Linux下nginx配置证书实现https访问 一.下载并安装nginx (1)执行下列命令安装Nginx.yum install -y nginx 参考自https://www.cnblogs.c ...

  5. 阿里云nginx站点http升级https

    1.站点升级https 将站点升级为https可以分四步走: 1.搞到SSL证书 2.正确配置Nginx 3.把SSL证书上传到服务器上 4.将http重定向为https 获取SSL证书 第一步非常容 ...

  6. Nginx 配置 SSL 证书 + HTTPS 站点小记

    今天给几个站点配置了认证的 ssl 证书,但是苦于自己技术不过关,或是知识不足,导致还有那么一小点 Bug 的出现,这里就我配置 HTTPS 站点的经验来总结一下吧. 一.什么是 SSL 证书,什么是 ...

  7. Nginx 配置 SSL 及 HTTPS 协议通信过程

    一.前言 基础知识 1.1 公钥密码体制(public-key cryptography) 公钥密码体制分为三个部分,公钥.私钥.加密解密算法,它的加密解密过程如下: 加密:通过加密算法和公钥对内容( ...

  8. nginx配置阿里云https的坑

    0.在阿里云官网上有免费的ssl证书可以下载,很多人说找不到,应该是这样的: 点击Symantec -> 点击1个域名 -> 点击免费型DV SSL 这里的免费型选项必须先点了1个域名才能 ...

  9. nginx配置http和https共存

    给nginx配置SSL证书之后,https可以正常访问,http访问显示400错误,nginx的配置如下:server { listen 80 defa 给nginx配置SSL证书之后,https可以 ...

最新文章

  1. s-stat 查看文件或者文件系统的状态信息
  2. TypeScript 基础类型
  3. matlba 正交基
  4. 计算机网络的网络实验有哪几种,计算机网络实验一 网络设备的认识.doc
  5. C++primer习题--第1章
  6. 修改Linux主机名和IP
  7. 测试项目:车牌检测,行人检测,红绿灯检测,人流检测,目标识别
  8. pysimplegui 显示 html,PySimpleGUI 的第一个桌面软件
  9. 初入前端框架bootstrap--Web前端
  10. 七年级计算机与信息安全教案,计算机与信息安全教案.docx
  11. vue中常用的事件修饰符
  12. 2015蓝桥杯C++A:牌型种数(分配问题)
  13. php合成图片系统,php图片合成
  14. 网购中7天无理由退货、运费险及退货退款流程图
  15. 【STP】STP(802.1D)端口状态及拓扑变更
  16. 全国计算机一级考试题库及答案(2018)
  17. SRE(站点可靠性工程)介绍
  18. 微信会员卡跳转小程序实现
  19. HW红队攻防基础建设—C2 IP隐匿技术
  20. 【100 种语言速成】第 1 节:Python

热门文章

  1. gaussDB200 单节点安装
  2. 小程的第一节C语言课
  3. TM1668兼用VK1668 SOP24/SSOP24 应用于VCR.DVD 等产品的显示驱动
  4. 一些代码静态检查工具的简介
  5. # Java 并发编程的艺术(一)
  6. linux下无线网卡测试,Linux C程序如何检测WIFI无线USB网卡是否可用?
  7. 开学季:20本Python经典书单
  8. 程序员应该怎么学数学?
  9. Python机器学习基础篇三《无监督学习与预处理》
  10. php js 对象追加元素,JS添加元素新节点