nginx配置文件 http 强跳转 https
路径 /usr/local/nginx/conf/conf.d/test.jackcui.com.conf
server {
listen 80;
server_name test.jackcui.com;
rewrite ^(.*)$ https://${server_name}$1 permanent;
}
server {
listen 443 ssl;
server_name test.jackcui.com;
access_log /data2/log/nginx/test.jackcui.com_access.log;
error_log /data2/log/nginx/test.jackcui.com_error.log;
ssl_certificate cert/2351572__jackcui.com.pem;
ssl_certificate_key cert/2351572__jackcui.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://10.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $remote_addr;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
client_max_body_size 1024M; # Set higher depending on your needs
}
}
路径 /usr/local/nginx/conf/nginx.conf
user nginx;
worker_processes 2; events {
use epoll;
worker_connections 102400;
} http {
include mime.types;
default_type application/octet-stream; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65; #gzip on; server {
listen 80;
server_name default_server; location / {
root /data1/web/default;
index index.html index.htm;
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} }
include conf.d/*.conf; # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }
nginx配置文件 http 强跳转 https的更多相关文章
- nginx配置http强制跳转https
nginx配置http强制跳转https 网站添加了https证书后,当http方式访问网站时就会报404错误,所以需要做http到https的强制跳转设置. 一.采用nginx的rewrite方法 ...
- Nginx配置——区分PC或手机访问不同域名以及http跳转https
新官网上线,但在手机上访问新官网的体验很差,要求在手机上访问新官网时访问旧官网,可以通过修改Nginx配置来实现自动跳转.首先是新官网的Nginx配置文件加个跳转判断,通过user-agent判断来源 ...
- nginx证书制作以及配置https并设置访问http自动跳转https(反向代理转发jboss)
nginx证书制作以及配置https并设置访问http自动跳转https 默认情况下ssl模块并未被安装,如果要使用该模块则需要在编译时指定–with-http_ssl_module参数,安装模块依赖 ...
- nginx开启HSTS让浏览器强制跳转HTTPS访问
在上一篇文章中我们已经实现了本地node服务使用https访问了,看上一篇文章 效果可以看如下: 但是如果我们现在使用http来访问的话,访问不了.如下图所示: 因此我现在首先要做的是使用nginx配 ...
- windwos下nginx 配置https并http强制跳转https
windwos下nginx 配置https并http强制跳转https 一.首先配置证书文件 申请证书文件,这里就不做详细过程了,直接看证书文件结果. 这是两个证书的关键文件 打开ngxin下con ...
- Nginx 配置 http 强制跳转到 https
个人真实配置 架构:Nginx 反向代理 + Nginx 前端(LNMP) 在 Nginx 反向代理的 虚拟机主机配置文件中,作如下配置: upstream ilexa_cn { server 192 ...
- Nginx配置http跳转https访问
Nginx强制http跳转https访问有以下几个方法 nginx的rewrite方法 可以把所有的HTTP请求通过rewrite重写到HTTPS上 配置 方法一 server{ listen ; s ...
- 【虚拟机-网关】如何在使用应用程序网关和 Nginx 的环境下实现强制 HTTPS 跳转
背景介绍 大家在使用 Nginx 部署网站时,实现 HTTP 到 HTTPS 的强制跳转是非常容易的事情,一般可以使用rewrite 命令或者使用返回自定义 301 页面的方法对 HTTP 请求进行 ...
- Nginx实现同一端口HTTP跳转HTTPS
小目标:在只监听一个端口的情况下,将http访问跳转为https. 一般情况下http协议使用80端口,https协议443端口.要实现http强制转https是非常简单的事,随便都可以找到很多方案. ...
随机推荐
- [TimLinux] CSS 实现加载中的动画
内容来自对<CSS世界>学习代码的理解简化: <!DOCTYPE html> <html> <head> <style> div { pad ...
- 【新】Docker实战总结
>>> 目录 <<< Docker简介 Docker优势 Docker基本概念 Docker安装使用 Docker常用命令 Docker镜像构建 Docker本地仓 ...
- .net core 微服务通讯组件Orleans的使用与配置
Orleans非常好用 并且支持.net core 社区也非常活跃 Orleans2.0+在国内的教程偏少 多数是1.5版本的教程 在这里写上四篇Orleans教程 目录 1.Orleans的入门教程 ...
- 【MobX】391- MobX 入门教程(下)
点击上方"前端自习课"关注,学习起来~ 三.MobX 常用 API 介绍 3. 修改可观察数据 在上一部分内容中,我们了解到,对可观察的数据做出反应的时候,需要我们手动修改可观察数 ...
- 修改CentOS7网卡名字
需求:CentOS7网卡名字不像之前CentOS6版本的eth0,eth1这样的名字了,而是enoxxx比较长,不太容易记忆,操作也不方便!这时候就需要改网卡名字了. 1 :查看你的CentOS7 ...
- nginx 自启动设置
首先,在linux系统的/etc/init.d/目录下创建nginx文件,使用如下命令: 1 vim /etc/init.d/nginx 在脚本中添加如下命令: #!/bin/sh # # nginx ...
- 理解django的框架为何能够火起来
理解django的框架为何能够火起来 https://www.yiibai.com/django/django_basics.html https://code.ziqiangxuetang.com/ ...
- 酷狗音乐API接口大全(40+个)
歌单分类部分 获取精选专区所有分类 http://mobilecdnbj.kugou.com/api/v3/tag/list?pid=0&apiver=2&plat=0 获取热门推荐分 ...
- SpringBoot微服务电商项目开发实战 --- 分布式文件系统实现
SpringBoot分布式开发系列文章已经持续了一段时间了,每一篇都有核心内容讲给大家.比如:分环境部署配置及服务端口号统一配置,子模块版本号管理及第三方jar依赖管理,单点登录实现,接口安全(签名+ ...
- net core 3.1 跨域 Cors 找不到 “Access-Control-Allow-Origin”
首先在ConfigureServices添加 public void ConfigureServices(IServiceCollection services) { services.AddCors ...