在docker 配置的环境下使用https

nginx 配置

server {
    listen       443 ssl;
    server_name  www.nuxtv.com;

    root   /usr/share/nginx/html/nuxtv;
    index  index.html index.htm index.php;
    location / {
    if (!-f $request_filename){
            rewrite ^/(.*)$ /index.php?s=$1 last;
            break;
        }
    }
    ssl_certificate   nuxtv/nuxtv.pem;
    ssl_certificate_key  nuxtv/nuxtv.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;
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
            root   /usr/share/nginx/html;
    }

    location ~ \.php$ {
            fastcgi_pass   php:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /www/nuxtv/$fastcgi_script_name;
            include        fastcgi_params;
    }
}

ssl证书位置

首先,把证书上传到服务器,然后把证书复制到nginx的容器里面/etc/nginx 目录