nginx 配置https

server {
  listen 80;
  server_name  www.wubuze.top;
  rewrite ^(.*) https://$host$1 permanent;
}

server {
  listen 80;
  server_name wubuze.top;
  rewrite ^(.*) https://www.wubuze.top$1 permanent;

}
 

server {
  listen 443;
  server_name  www.wubuze.top;
  ssl on;
  ssl_certificate 1_wubuze.top_bundle.crt;
  ssl_certificate_key 2_wubuze.top.key;
  ssl_session_timeout 5m;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
  ssl_prefer_server_ciphers on;
  if ($host = wubuze.top ) { return 301 $scheme://www.wubuze.top$request_uri;  }
  if ($host != www.wubuze.top) { return 501; }


  access_log /xxx/wwwlogs/wubuze.top_nginx.log combined;
  index index.php  index.html;
  root /xxx/www/blog/public;

  include /usr/local/nginx/conf/rewrite/none.conf;
  #error_page 404 /404.html;
  #error_page 502 /502.html;

  location / {
    try_files $uri $uri/ /index.php?$query_string;
  }

  location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
  }

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|LICENSE|README\.md) {
    deny all;
  }
}
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章