全球主机交流论坛
标题:
求助关于在http2的情况下80条转443的办法
[打印本页]
作者:
妖言惑众
时间:
2022-6-24 13:45
标题:
求助关于在http2的情况下80条转443的办法
因为http2支支持ssl,所以80访问的时候是直接报错的,如果在这种情况下自动跳转到443呢?因为直接访问80是报错的,所以下面其他的判断跳转是不生效的
作者:
xshell
时间:
2022-6-24 13:50
server
{
listen 80;
listen 443 ssl http2;
server_name ;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/;
#digitalocean nginx配置
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
log_not_found off;
types_hash_max_size 2048;
types_hash_bucket_size 64;
client_max_body_size 16M;
#禁止某个人IP访问
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
#error_page 404/404.html;
#HTTP_TO_HTTPS_START
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
复制代码
我这个难道是假的http2?
作者:
妖言惑众
时间:
2022-6-24 13:52
xshell 发表于 2022-6-24 13:50
我这个难道是假的http2?
老哥,你的http2很真,主要是我的网络很假,刚刚不知道咋回事http访问直接被重置,现在好了
欢迎光临 全球主机交流论坛 (https://sunk.eu.org/)
Powered by Discuz! X3.4