目的:访问http://sdk.open.test.com/时强制自动跳转到https://sdk.open.test.com/
修改nginx站点配置文件sdk.open.test.com.conf
server
{
listen 80;
server_name sdk.open.test.com;
return 301 https://$server_name$request_uri;
}
server
{
listen 443 ssl;
server_name sdk.open.test.com;
index index.html index.htm index.php;
root /data/www/web/;
charset utf-8;
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;
}
ssl on;
ssl_certificate /usr/local/nginx/ssl/ea93balk25xh3f9.crt;
ssl_certificate_key /usr/local/nginx/ssl/9yrt62bv1z4s35la.key;
access_log /data/logs/sdk.open.test.com.access.log access;
error_log /data/logs/sdk.open.test.com.error.log warn;
}