ubuntu16.04、nginx、https、golang

栏目: 服务器 · Nginx · 发布时间: 7年前

内容简介:下面的这个配置,最后验证是可以的。只是没有跳转下面这个跳转成功了

下面的这个配置,最后验证是可以的。只是没有跳转

server {
        listen 80;
        listen 443 ssl;
        #ssl on;
        server_name hc-explorer.h.cash;
        ssl_certificate /etc/nginx/cert/7d97acd273b4a22.crt;
        ssl_certificate_key /etc/nginx/cert/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 / {
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                 proxy_redirect off;
                proxy_pass http://localhost:7789;
        }
}

下面这个跳转成功了

server{
        listen 80;
        server_name hc-explorer.h.cash;
        rewrite ^ https://$http_host$request_uri? permanent;
}
server {
        listen 443 ssl;
        #ssl on;
        server_name hc-explorer.h.cash;
        ssl_certificate /etc/nginx/cert/7d97acd273b4a22.crt;
        ssl_certificate_key /etc/nginx/cert/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 / {
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_redirect off;
                proxy_pass http://localhost:7789;
        }
}

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Delivering Happiness

Delivering Happiness

Tony Hsieh / Grand Central Publishing / 2010-6-7 / USD 27.00

http://www.deliveringhappinessbook.com/ The visionary CEO of Zappos explains how an emphasis on corporate culture can lead to unprecedented success. Pay new employees $2000 to quit. Make custome......一起来看看 《Delivering Happiness》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具