记 WordPress HTTPS Nginx 配置

给在阿里云的博客上HTTPS,折腾了一通,如下配置可行。

参考:阿里云上的教程

server {
  listen 443;
  server_name www.xxxx.com xxxx.com;
  ssl on;
  root html;
  index index.html index.htm index.php;
  ssl_certificate   /xxx/leeggco.com.pem;
  ssl_certificate_key  /xxx/leeggco.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;
  location / {
    root /var/www/html;
    index index.html index.htm index.php;

    # config for wordpress begin
    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;
    }
    # config for wordpress end
  }
  location ~ \.php$ {
    root /var/www/html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
  }
}

 

说点什么

avatar
  Subscribe  
提醒