nginx强制使用https访问(http跳转到https)
2015-06-02 22:02
896 查看
业务需要通过https提供服务,输入http自动跳转https.1.nginx的rewrite方法将所有的http请求通过rewrite重写到https上即可server {
listen 80;
server_name qunyingliu.qq.com;
rewrite ^(.*)$ https://$host$1 permanent;
}2. index.html刷新网页跳转
index.html
listen 80;
server_name qunyingliu.qq.com;
location / {
#index.html放在虚拟主机监听的根目录下
root /data/web/websites/qunyingliu.qq.com/http;
}
#将404的页面重定向到https的首页
error_page 404 https://qunyingliu.qq.com/; }
listen 80;
server_name qunyingliu.qq.com;
rewrite ^(.*)$ https://$host$1 permanent;
}2. index.html刷新网页跳转
index.html
<html> <meta http-equiv="refresh" content="0;url=https://qunyingliu.qq.com/"> </html>nginx配置server {
listen 80;
server_name qunyingliu.qq.com;
location / {
#index.html放在虚拟主机监听的根目录下
root /data/web/websites/qunyingliu.qq.com/http;
}
#将404的页面重定向到https的首页
error_page 404 https://qunyingliu.qq.com/; }
相关文章推荐
- 第8章双路由双网段网络互通实验(初级篇)
- linux网络编程学习之一网络字节序
- HttpClient基础
- Java UDP网络编程 简单实例
- Android Volley完全解析(二),使用Volley加载网络图片
- 【Android】asynchronous http client
- Android-网络通信HTTP-Volley
- 菜鸟学Android笔记(十七):http协议概述
- android 使用post方式进行网络连接
- 网络编程
- Android之Http通信——2.详解Http的消息头与响应头
- Socket 网络编程
- 网络通信框架Volley的学习(一)
- 网络请求的步骤:
- Android之Http通信——1.初识Http协议
- Java Http GET POST发送请求
- HTTP 1.1状态代码及其含义
- rtp协议详解/rtcp协议详解
- Namespace:Openstack的网络实现
- Ubuntu 14.1 配置NFS