1 server { 2 listen 80; 3 server_name demo.nrst.top; 4 rewrite ^(.*)$ https://${server_name}$1 permanent; 5 } 6 7 server { 8 listen 443 ssl; # 1.1版本后这样写 9 server_name demo.nrst.top; #填写绑定证书的域名 10 ssl_certificate ssl/demo.nrst.top.pem; # 指定证书的位置,绝对路径 11 ssl_certificate_key ssl/demo.nrst.top.key; # 绝对路径,同上 12 ssl_session_timeout 5m; 13 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置 14 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置 15 ssl_prefer_server_ciphers on; 16 17 location / { 18 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 19 proxy_pass http://localhost:55328; 20 } 21 22 location /chatHub { 23 proxy_http_version 1.1; 24 proxy_cookie_path /project /proxy_path; 25 proxy_set_header Upgrade $http_upgrade; 26 proxy_set_header Connection "Upgrade"; 27 proxy_pass http://localhost:55328/chatHub; 28 } 29 }