示例

worker_processes 1;

events {
worker_connections 1024;
} http {
#均衡负载
upstream demo{
server localhost:55328;
server localhost:55329;
} include mime.types;
default_type application/octet-stream; sendfile on;
#保持连接时间
keepalive_timeout 65;
#允许请求最大数据量
client_max_body_size 500m;
map $http_upgrade $connection_upgrade {
default upgrade;
}
#访问80端口,重定向到https
server {
listen 80;
server_name [server_name];
rewrite ^(.*)$ https://${server_name}$1 permanent;
} server {
listen 443 ssl;
server_name [server_name]; #ssl_certificate ./ssl/[server_name].pem; # 指定证书的位置,Linux上可以设置相对路径,Windows上要设置绝对路径
#ssl_certificate_key ./ssl/[server_name].key; # 同上
#ssl_trusted_certificate ./ssl/[server_name].cer; ssl_certificate ./ssl/fullchain.cer;
ssl_certificate_key ./ssl/[server_name].key; ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
ssl_prefer_server_ciphers on; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; location / {
proxy_connect_timeout 1;
proxy_pass http://demo;
}
location /NotiHub {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://demo/NotiHub;
}
location /TaskLogHub {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://demo/TaskLogHub;
}
location = /50x.html {
root html;
}
error_page 404 500 502 503 504 /50x.html;
}
}

配置说明

#转发Tcp
stream {
proxy_timeout 30m;
server {
listen 8080;
proxy_pass localhost:55328;
}
}
#使用 WebSocket 需要添加以下配置
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
#使用 SSE 需要添加以下配置
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1; proxy_set_header Connection;
chunked_transfer_encoding off;
proxy_cache off;

Nginx配置https以及配置说明的更多相关文章

  1. Nginx配置Https

    1.申请证书: https://console.qcloud.com/ssl?utm_source=yingyongbao&utm_medium=ssl&utm_campaign=qc ...

  2. 【转】Linux下nginx配置https协议访问的方法

    一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...

  3. nginx配置https双向验证(ca机构证书+自签证书)

    nginx配置https双向验证 服务端验证(ca机构证书) 客户端验证(服务器自签证书) 本文用的阿里云签发的免费证书实验,下载nginx安装ssl,文件夹有两个文件 这两个文件用于做服务器http ...

  4. Nginx 配置https 服务

    一.HTTPS 服务 为什么需要HTTPS? 原因:HTTP不安全 1.传输数据被中间人盗用.信息泄露 2.数据内容劫持.篡改 HTTPS协议的实现 对传输内容进行加密以及身份验证 HTTPS加密校验 ...

  5. nginx配置https转发到tomcat(使用自签名的证书)

    一.使用openSSL生成自签名的证书 1.生成RSA私钥 命令:openssl genrsa -des3 -out server.key 1024 说明:生成rsa私钥,des3算法,1024强度, ...

  6. RedHat 6.6下安装nginx,配置HTTPS

    1.安装依赖包 yum -y install pcre-devel openssl-devel zlib-devel 2.下载nginx安装包到服务器上,当前使用版本nginx-1.15.5.tar. ...

  7. nginx 配置https并自签名证书

    2016-10-28 转载请注明出处:http://daodaoliang.com/ 作者: daodaoliang 版本: V1.0.1 邮箱: daodaoliang@yeah.net 参考链接: ...

  8. [记录]NGINX配置HTTPS性能优化方案一则

    NGINX配置HTTPS性能优化方案一则: 1)HSTS的合理使用 2)会话恢复的合理使用 3)Ocsp stapling的合理使用 4)TLS协议的合理配置 5)False Start的合理使用 6 ...

  9. 购买https证书以及nginx配置https

    文章来源 运维公会:购买https证书以及nginx配置https 1.https的作用 https的全名是安全超文本传输协议,是在http的基础上增加了ssl加密协议.在信息传输的过程中,信息有可能 ...

随机推荐

  1. MySQL的安装及安装问题解答(一)

    1. MySQL简介 MySQL属于关系型数据库管理系统,RDBMS(Relational Datebase Management System), 前身为瑞典MySQL AB公司开发,当前属于Orq ...

  2. uniApp打卡日历

    功能 滑动切换时间,打点功能,支持月周切换日历组件    这是一款支持滑动切换以及周模式和月模式切换功能的日历组件,可以设置打卡信息,自定义样式. 组件样式使用了sass所有需要项目中先安装node- ...

  3. css3 @keyframe 抖动/变色动画

    一.纯css实现 .shake{    //抖动的元素    width: 200px;    height: 100px;    margin: 50px auto;    background: ...

  4. QQ彩贝热销时装

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  5. AES的数学基础

    有限域 有限域上的运算 加法 两个多项式进行加法运算,就是两个多项式对应系数模2相加 乘法 两个多项式进行乘法运算:两个多项式相乘 若运算结果超过7次方,则必须对此结果进行一个多项式m(x)模运算,其 ...

  6. 【python】将变量保存在本地及读取

    在用jupyter notebook写python代码的过程中会产生很多变量,而关闭后或者restart jupyter kernel后所有变量均会消失,想要查看变量就必须将代码重新再运行一遍,而想在 ...

  7. tp3.2关闭debug save方法执行失败

    解决该问题需要 清除缓存文件 将retime下的文件删除

  8. JS超酷时钟的制作

    通过补充代码,实现时钟实时显示当前时间:年.月.日.时.分.秒.日期. <!DOCTYPE html> <html> <head lang="zh-CN&quo ...

  9. Socket bind系统调用简要分析

    主要查看linux kernel 源码:Socket.c 以及af_inet.c文件 1.1 bind分析 #include <sys/types.h> /* See NOTES */#i ...

  10. linux用户的增删改查(useradd/id/usermod/userdel)

    与用户(user)相关的配置文件:  /etc/passwd 注:用户(user)的配置文件: /etc/shadow 注:用户(user)影子口令文件: 与用户组(group)相关的配置文件:  / ...