Nginx配置http强制跳转到https

目的:访问http://sdk.open.test.com/时强制自动跳转到https://sdk.open.test.com/php

修改nginx站点配置文件sdk.open.test.com.conf css

server
{
  listen 80;
  server_name sdk.open.test.com;
  return 301 https://$server_name$request_uri;html

}nginx

server
{
  listen 443 ssl;
  server_name sdk.open.test.com;
  index index.html index.htm index.php;
  root /data/www/web/;
  charset utf-8;web

  location ~.*\.(swf|xml|mp3|png|jpg|gif|data)$ {
  expires max;
  }

  location ~.*\.(css|js|mx)$ {
  expires 96h;
  }

  location ~ /.svn/ {
  deny all;
  }

  location ~ .*\.php$
  {
    include fastcgi.conf;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    expires off;
  }svn

  ssl on;
  ssl_certificate /usr/local/nginx/ssl/ea93balk25xh3f9.crt;
  ssl_certificate_key /usr/local/nginx/ssl/9yrt62bv1z4s35la.key;spa

  access_log /data/logs/sdk.open.test.com.access.log access;
  error_log   /data/logs/sdk.open.test.com.error.log warn;
}server