服务器开启https访问(需要先申请好ssl)

server {
        listen       80;
        server_name  xxx.com;
        return 301 https://$server_name$request_uri;
        client_max_body_size 64m;

        location / {
            root   html;
            index  index.php index.html index.htm;
            if (-f $request_filename/index.html){
               rewrite (.*) $1/index.html break;
            }
            if (-f $request_filename/index.php){
               rewrite (.*) $1/index.php;
            }
            if (!-f $request_filename){
               rewrite (.*) /index.php;
            }
            try_files $uri $uri/ =404;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

  
        location ~ \.php$ {
            root           html;
            #root           /root/wordpress;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;

        }

}
server {
        listen       443 ssl;
        server_name  xxx.com;
        root         html;
        index        index.php index.html index.htm;
        ssl_certificate      /usr/local/nginx/conf/cert/appleyun.cn_bundle.crt;
        ssl_certificate_key  /usr/local/nginx/conf/cert/appleyun.cn.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;

        ssl_prefer_server_ciphers  on;
        location / {
        root   html;
        index  index.php index.html index.htm;
        if (-f $request_filename/index.html){
               rewrite (.*) $1/index.html break;
        }
        if (-f $request_filename/index.php){
               rewrite (.*) $1/index.php;
         }
        if (!-f $request_filename){
               rewrite (.*) /index.php;
         }
        try_files $uri $uri/ =404;
    }
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;

        location ~ \.php$ {
             root           html;
             fastcgi_pass   127.0.0.1:9000;
             fastcgi_index  index.php;
             #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
             client_max_body_size 2G;
             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
             include        fastcgi_params;
         }
    location ~ /\.ht {
       deny  all;
   }
    }

}

腾讯云详细链接

你可能感兴趣的:(ssl,服务器,https)