nginx 配置https 并且http强制跳转https

server
{

   listen 80;

   server_name zuzv.com;
   server_name www.zuzv.com;

   rewrite ^(.*)$ https://$host$1  permanent;
}


server
    {
        listen 443 ;
        ssl on;

        server_name zuzv.com;
        server_name www.zuzv.com;

        index index.html index.htm index.php;
        root  /var/www/zuzv/;


    ssl_certificate   ./cert/7290604.zuzv.com.pem;
    ssl_certificate_key  ./cert/7290604_.zuzv.com.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   404   /404.html;
        include enable-php.conf;

        location / {
    if (!-e $request_filename){
         rewrite ^/index.php(.*)$ /index.php?s=$1 last;
         rewrite ^(.*)$ /index.php?s=$1 last;
         break;
    }
}

 location /nginx_status
        {
            stub_status on;
            access_log   off;
        }


        location ~ .*.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.
        {
               allow  all;

        }

    }
经验分享 程序员 微信小程序 职场和发展