惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Spread Privacy
Spread Privacy
T
Threatpost
L
LINUX DO - 热门话题
Google Online Security Blog
Google Online Security Blog
I
InfoQ
大猫的无限游戏
大猫的无限游戏
博客园_首页
爱范儿
爱范儿
有赞技术团队
有赞技术团队
V
Visual Studio Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Jina AI
Jina AI
博客园 - 聂微东
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
C
CERT Recently Published Vulnerability Notes
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
K
Kaspersky official blog
L
LangChain Blog
G
GRAHAM CLULEY
B
Blog RSS Feed
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
About on SuperTechFans
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
Help Net Security
Help Net Security
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
雷峰网
雷峰网
C
Check Point Blog
MongoDB | Blog
MongoDB | Blog
NISL@THU
NISL@THU
L
Lohrmann on Cybersecurity
Vercel News
Vercel News
T
Tor Project blog
T
The Exploit Database - CXSecurity.com
T
Troy Hunt's Blog
W
WeLiveSecurity
T
Threat Research - Cisco Blogs

博客园 - dcrenl

解决CapabilityAccessManager.db-wal 文件过大 Java 应用程序在linux环境中读取和写入 Microsoft Access 数据库(包括 .mdb 和 .accdb 格式)的开源库 windows 版本nginx报错:maximum number of descriptors supported by select() is 1024 while 删除多个网关 dot net6 在win7上运行报错 远程重启服务器 sqlserver 20008 R2 关闭TLS1.0无法启动服务的解决办法 rust 模块和引用 nohup java按天输出日志 idea 社区版本创建android原生项目 解决win11输入法自定义短语有多个当前日期只有最后一个生效 postgresql使用for循环 Win10打开IE自动跳转至Edge解决办法 身份认证与授权 pnpm : 无法加载文件 \AppData\Roaming\npm\pnpm.ps1,因为在此系统上禁止运行脚本。 - dcrenl C# 获取时间戳 win11 输入法自定义短语输出日期时间变量 SM系列国密算法 Opera打不开网页解决办法 excel 数字转中文大写金额
nginx http跳转到https
dcrenl · 2022-05-25 · via 博客园 - dcrenl
  1. 修改nginx配置文件"nginx.conf"

  2. 找到"server"结点

  3. 如将80端口http跳转到443端口时使用如下方式:

server {
	listen       80;
	listen       [::]:80;
	server_name  server_name;
	
	return 301 https://$http_host$request_uri; #第一种方式:(推荐)
	rewrite ^(.*) https://$server_name$1 permanent; #第二种方式
	error_page 497 https://$host:8080$request_uri; #第三种方式,重新定义端口

	error_page 404 /404.html;
	location = /404.html {
	}

	error_page 500 502 503 504 /50x.html;
	location = /50x.html {
	}
}
  1. 如https端口为其它端口,需要原端口http跳转为https使用如下方式:
server {
	listen 8888 ssl http2; 
	server_name server_name_ssl;
	ssl_certificate /home/ssl/rsa.pem;
	ssl_certificate_key /home/ssl/rsa.key;
	ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #表示使用的TLS协议的类型。
	ssl_prefer_server_ciphers on;

	error_page 497 301 =307 https://$host:$server_port$request_uri; #如https为特殊端口时可使用此方式客户端访问http时自动为https
    
	root         /usr/share/nginx/html;

	error_page 404 /404.html;
	location = /404.html {
	}

	error_page 500 502 503 504 /50x.html;
	location = /50x.html {
	}
}