美文网首页技术文章
[nginx] 通过nginx反向代理给网站添加 https 证

[nginx] 通过nginx反向代理给网站添加 https 证

作者: w_w_wei | 来源:发表于2019-04-07 01:51 被阅读197次

通过nginx反向代理给网站添加 https 证书。
正常网站监听端口 8088 http

申请证书: https://www.jianshu.com/p/7cf4d5d1363f

easyswoole的https不知道怎么配置的。
通过nginx 和反向代理给 8088 端口加上https证书。

server {
    listen  80;
    server_name www.gl6.cc;
    rewrite ^(.*)$  https://$host$1 permanent;
}
upstream hello{
    server www.gl6.cc:8088 weight=1;
}

server {
        listen 443 ssl;
        ssl on;
        ssl_certificate /root/.acme.sh/*.gl6.cc/*.gl6.cc.cer;
        #ssl_certificate /etc/letsencrypt/live/www.gl6.cc/fullchain.pem;
        #ssl_certificate_key /etc/letsencrypt/live/www.gl6.cc/privkey.pem;
        ssl_certificate_key /root/.acme.sh/*.gl6.cc/*.gl6.cc.key;

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;

        server_name www.lover9.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root /usr/share/nginx/html;

        location / {
                index index.html,index.php;
                proxy_pass   http://hello;
                proxy_redirect             off;
                proxy_set_header           Host $host;
                proxy_set_header           X-Real-IP $remote_addr;
                proxy_set_header           X-Forwarded-For $proxy_add_x_forwarded_for;
                client_max_body_size       10m;
                client_body_buffer_size    128k;
                proxy_connect_timeout      300;
                proxy_send_timeout         300;
                proxy_read_timeout         300;
                proxy_buffer_size          4k;
                proxy_buffers              4 32k;
                proxy_busy_buffers_size    64k;
                proxy_temp_file_write_size 64k;
    }
}

相关文章

网友评论

    本文标题:[nginx] 通过nginx反向代理给网站添加 https 证

    本文链接:https://www.haomeiwen.com/subject/exkjiqtx.html