1.rewrite

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

2. nginx状态码 497重定向

server {
listen 443;
listen 80;
server_name a.com;
ssl on; ssl_certificate /etc/nginx/test.pem;
ssl_certificate_key /etc/nginx/test.key; error_page 497 https://$host$uri?$args;
}

  

3.页面刷新

<html>
<meta http-equiv="refresh" content="0;url=https://a.com/">
</html>
server {
listen ;
server_name a.com; location / { root /www/;
} error_page https://a.com/;
}

nginx将http重定向到https的更多相关文章

  1. nginx服务器http重定向到https的正确写法

    http重定向到https使用了nginx的重定向命令.那么应该如何写重定向?之前老版本的nginx可能使用了以下类似的格式. rewrite ^/(.*)$ http://domain.com/$1 ...

  2. nginx 配置http重定向到https

    在80端口的那个server下,添加如下: server_name www.youwebsite.com youwebsite.com; rewrite ^(.*)$ https://$host$1 ...

  3. nginx让所有的http地址重定向到https

    问:为什么让所有的http都重定向到https呢?答:因为这样会使网站更安全些. 那么我是如何在nginx配置,让输入http://www.youcongtech.com或者youcongtech.c ...

  4. nginx中实现把所有http的请求都重定向到https

    在网站启用https之后,我们可能会有一个需求,就是将所有的http的请求自动地重定向到https, 如果前端是使用的nginx来实现的https,我们可以这样配置nginx的301重定向: serv ...

  5. Nginx下HTTP强制重定向至HTTPS

    Nginx下HTTP强制重定向至HTTPS 对于nginx来说,配置http强制重定向至https有多种多样的写法.可以直接rewrite,也可以用301重定向.但是直接拷贝网上的配置往往会出现问题, ...

  6. nginx开启ssl并把http重定向到https的两种方式

    1 简介 Nginx是一个非常强大和流行的高性能Web服务器.本文讲解Nginx如何整合https并将http重定向到https. https相关文章如下: (1)Springboot整合https原 ...

  7. 如何配置Nginx,实现http访问重定向到https?

    现在越来越多的网站,当我们输入域名时,会自动重定向到https,我们只需要简单修改下Nginx配置文件/usr/local/nginx/conf/nginx.conf(根据个人的实际存储路径)即可. ...

  8. nginx http跳转到https

    server { listen 80; server_name www.888.com; location / { #index.html放在虚拟主机监听的根目录下 root /usr/local/n ...

  9. nginx申请并配置免费https

    你还在让你的网站裸奔在网络上吗?在这里我们将搭建免费版HTTPS,免费的,免费的,免费的,重要的事情说三遍,申请来源为letsencrypt, 超文本传输协议HTTP协议被用于在Web浏览器和网站服务 ...

随机推荐

  1. POJ:最长上升子序列

    Title: http://poj.org/problem?id=2533 Description A numeric sequence of ai is ordered if a1 < a2  ...

  2. 通过Instant Client包来使用SQL*PLUS

    1.首先下载两个程序包: Instant Client Package - Basic(或Instant Client Package - Basic Lite)包 Instant Client Pa ...

  3. delphi 对话框初始地址InitialDir

    我的电脑:SaveDialog1.InitialDir := '::{20D04FE0-3AEA-1069-A2D8-08002B30309D}';// My Computer {20D04FE0-3 ...

  4. 最好用的汉字转拼音代码PinYin4Objc(PinYin4J的objc版本)

    转:https://github.com/kimziv/PinYin4Objc 最好用的汉字转拼音代码PinYin4Objc(PinYin4J的objc版本)(更新到v1.1.1,增加block异步处 ...

  5. Matlab编程实例(3) 函数向左或向右平移N点 左移右移

    %函数移动 close all; clear all; dir=input('请输入平移方向,“1”为向左,“2”为向右'); if dir~=1&&dir~=2;%输入控制    e ...

  6. [原创]Android应用 - YE启动器APP(YeLauncherApp)

      支持解冻.冻结APP 支持在本APP列表隐藏指定APP 支持检测系统核心APP,防止误点冻结导致手机变砖 支持清理APP缓存 支持强制停止APP Apk文件仅仅47KB 自用.开源 类似APP:A ...

  7. C++实现网格水印之调试笔记(六)——补充

    调用matlab生成的网格水印特征向量矩阵 从文件中读取的原始网格的特征向量矩阵 好吧,之前得出的结果不正确是因为代码写错了.因为实现论文中的提取方案时代码写错了,自己想了另外一个方法,结果方向两者在 ...

  8. trie树 Codeforces Round #367 D Vasiliy's Multiset

    // trie树 Codeforces Round #367 D Vasiliy's Multiset // 题意:给一个集合,初始有0,+表示添加元素,-去除元素,?询问集合里面与x异或最大的值 / ...

  9. 在虚拟机VM中安装的Ubuntu上安装和配置Hadoop

    一.系统环境: 我使用的Ubuntu版本是:ubuntu-12.04-desktop-i386.iso jdk版本:jdk1.7.0_67 hadoop版本:hadoop-2.5.0 二.下载jdk和 ...

  10. matplotlib绘制三维图

    本文参考官方文档:http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html 起步 新建一个matplotlib.figure.Figure对象, ...