nginx配置腾讯云 https

Blade 未结 1 610
xjl234
xjl234 剑圣 2021-09-09 21:01

一、该问题的重现步骤是什么?

  1. 按照腾讯云   配置https 无效

   

 配置文件:



#user  nobody;

worker_processes  1;


#error_log  logs/error.log;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;


#pid        logs/nginx.pid;



events {

    worker_connections  1024;

}



http {

    include       mime.types;

    default_type  application/octet-stream;


    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

    #                  '$status $body_bytes_sent "$http_referer" '

    #                  '"$http_user_agent" "$http_x_forwarded_for"';


    #access_log  logs/access.log  main;


    sendfile        on;

    #tcp_nopush     on;


    #keepalive_timeout  0;

    keepalive_timeout  65;


    #gzip  on;








    server {

       

        listen 80;

#填写绑定证书的域名

server_name xxxx域名; 

#把http的域名请求转成https

return 301 https://$host$request_uri; 











        #error_page  404              /404.html;


        # redirect server error pages to the static page /50x.html

        #

        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }


        # proxy the PHP scripts to Apache listening on 127.0.0.1:80

        #

        #location ~ \.php$ {

        #    proxy_pass   http://127.0.0.1;

        #}


        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

        #

        #location ~ \.php$ {

        #    root           html;

        #    fastcgi_pass   127.0.0.1:9000;

        #    fastcgi_index  index.php;

        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

        #    include        fastcgi_params;

        #}


        # deny access to .htaccess files, if Apache's document root

        # concurs with nginx's one

        #

        #location ~ /\.ht {

        #    deny  all;

        #}

    }



    # another virtual host using mix of IP-, name-, and port-based configuration

    #

    #server {

    #    listen       8000;

    #    listen       somename:8080;

    #    server_name  somename  alias  another.alias;


    #    location / {

    #        root   html;

    #        index  index.html index.htm;

    #    }

    #}



    # HTTPS server

    #

    server {

        listen 443 ssl; 

 #填写绑定证书的域名

    server_name xxxx域名; 

 #证书文件名称

    ssl_certificate xxxxx; 

 #私钥文件名称

    ssl_certificate_key xxxxx; 

    ssl_session_timeout 5m;

 #请按照以下协议配置

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 

 #请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。

    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; 

    ssl_prefer_server_ciphers on;


        #charset koi8-r;


        #access_log  logs/host.access.log  main;

           root   /usr/local/nginx/html;


   

 location /{


        }



           location  ^~/api {

           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_buffering off;

           rewrite ^/api/(.*)$ /$1 break;

          proxy_pass http://xxx后端ip地址:端口;


      }



   

    }


}



注意:这里得关键信息 已经省略,腾讯相关配置 得我觉得没问提,https://cloud.tencent.com/document/product/400/35244  这是他们得官方教程,我觉得可能是和项目nginx 结合得有问提,这里我需要说明 在没有配置 https 项目 运行 正常,辛苦群主给看一下,不要贴博客给我,我已经找了很多博客



二、你期待的结果是什么?实际看到的又是什么?


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

bladex 2.8.0 centos7.6

四、请提供详细的错误堆栈信息,这很重要。


五、若有更多详细信息,请在下面提供。

1条回答
  • 2021-09-09 22:20

    腾讯云的产品推荐给腾讯云发工单,我们还没有使用过腾讯云的ssl证书,他们比我们更有经验

    0 讨论(0)
提交回复