目的:访问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;
}

Nginx配置http强制跳转到https的更多相关文章

  1. Nginx 配置 http 强制跳转到 https

    个人真实配置 架构:Nginx 反向代理 + Nginx 前端(LNMP) 在 Nginx 反向代理的 虚拟机主机配置文件中,作如下配置: upstream ilexa_cn { server 192 ...

  2. nginx配置http强制跳转https

    nginx配置http强制跳转https 网站添加了https证书后,当http方式访问网站时就会报404错误,所以需要做http到https的强制跳转设置. 一.采用nginx的rewrite方法 ...

  3. tomcat7.0.55配置HTTP强制跳转到HTTPS

    首先需要配置好HTTPS单向或双向链接 参考: tomcat7.0.55配置单向和双向HTTPS连接(二) 然后编辑tomcat的conf目录下的web.xml 在<welcome-file-l ...

  4. Nginx的https配置记录以及http强制跳转到https的方法梳理

    一.Nginx安装(略)安装的时候需要注意加上 --with-http_ssl_module,因为http_ssl_module不属于Nginx的基本模块.Nginx安装方法: 1 2 # ./con ...

  5. (转)Nginx的https配置记录以及http强制跳转到https的方法梳理

    Nginx的https配置记录以及http强制跳转到https的方法梳理 原文:http://www.cnblogs.com/kevingrace/p/6187072.html 一.Nginx安装(略 ...

  6. 阿里云SLB上http强制跳转到https问题处理

    背景: 最近一客户有一个需求,需要将外网所有http访问请求强制跳转到https,公网出口使用阿里云SLB,证书放在SLB上,SLB后端实例为ECS(webserver)web服务使用nginx, 网 ...

  7. k8s ingress路由强制跳转至https设置

    为ingress配置增加注解(annotations):nginx.ingress.kubernetes.io/ssl-redirect: 'true' 就可以实现http强制跳转至https 不过默 ...

  8. http强制跳转到https

    原文地址:http://m.blog.csdn.net/article/details?id=8549290 需求简介 基于nginx搭建了一个https访问的虚拟主机,监听的域名是test.com, ...

  9. https进行配置以及http跳转到https配置

    https配置: nginx配置 server { listen 443; server_name localhost; ssl on; root html; index index.html ind ...

随机推荐

  1. android工程混淆和反编译

    一.工程文件的混淆 混淆文件下载:http://download.csdn.net/detail/lxq_xsyu/6328751 1.在根目录下添加progard.cfg文件 2.打开project ...

  2. EntityFramework 异常 -- An entity object cannot be referenced by multiple instances of IEntityChangeTracker

    问题      在调用 DbSet 的 Attach()  方法时(与将 Entity 设置为 EntityState.Unchanged 状态等价)报告以下错误:      An entity ob ...

  3. java学习面向对象之final关键字

    之前我们讲过继承的相关知识了,继承就是子类继承父类的属性和方法并且还可以覆盖父类的方法.但是这样有一个缺陷是什么呢,就是当我们一个类当中涉及一些封装的核心的东西或者对整个系统非常关键的方法或者类的时候 ...

  4. Spring - Web MVC简介

    Web MVC简介 1.1.Web开发中的请求-响应模型: 在Web世界里,具体步骤如下: 1.  Web浏览器(如IE)发起请求,如访问http://www.cnblogs.com 2.  Web服 ...

  5. 通过超链接打开App应用

    URL schemes, 通过超链接打开App应用 var mobileAppInstall = (function () { var ua = navigator.userAgent, loadIf ...

  6. 【转】iOS开发Xcode7真机调试教程

    原文网址:https://www.skyfox.org/ios-xcode7-debug-device.html 从Xcode7开始,Xcode 不需要$99/$299升级开发者直接可以进行真机调试 ...

  7. (转载)[MySQL技巧]INSERT INTO… ON DUPLICATE KEY UPDATE

    (转载)http://blog.zol.com.cn/2299/article_2298921.html MySQL 自4.1版以后开始支持INSERT … ON DUPLICATE KEY UPDA ...

  8. Unity Flow distort of screen

    Shader "ScreenWater" {Properties { _MainTex ("Base (RGB)", 2D) = "white&quo ...

  9. 1242Rescue (优先队列BFS)

    Problem Description Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is ...

  10. HDU 4432 Sum of divisors (进制模拟)

    三个小函数 getdiv();        求因子 getsum();     求平方和 change();     转换成该进制 #include <cstdio> #include ...