gpt4 book ai didi

ubuntu - Nginx 将 http 子域重定向到 https

转载 作者:太空宇宙 更新时间:2023-11-03 13:47:39 24 4
gpt4 key购买 nike

我有一个包含 3 个子域的域:

 - example.com (main domain) - api.example.com - blog.example.com - support.example.com (just a cname to point to zendesk)

And I have this 3 configuration on my Nginx:

api

# HTTP server
server {
listen 80;
server_name api.example.com;
return 301 https://api.example.com$request_uri;
}


# HTTPS server
server {
ssl on;
listen 443;
server_name api.example.com;

ssl_certificate APIcert.crt;
ssl_certificate_key APIcert.key;

#root configuration.....
}

博客

server {
listen 80;
server_name blog.example.com;

root /var/www/blog;
index index.php index.html index.htm;

站点/主域

server {
listen 80;
listen 443 ssl;
server_name www.example.com;
return 301 https://example.com$request_uri;

location ~ \.(php|html)$ {
deny all;
}
}

server {
listen 80;
server_name example.com;
return 301 https://example.com$request_uri;

location ~ \.(php|html)$ {
deny all;
}
}

server {
ssl on;
listen 443 ssl;
ssl_certificate mycert.crt;
ssl_certificate_key mycert.key;
server_name example.com;

root /var/www/frontend;
.....
}

我的问题:

最佳答案

您的 Web 服务器设置有 Strict-Transport-Security max-age=16070400; includeSubdomains.

这将告诉网络浏览器仅使用 https 请求您的域。如果您希望通过不安全的 http 访问子域 blog,您需要从 HTTP 严格传输安全 (HSTS) 中删除 includeSubdomains 并使用不同的浏览器(或清除你的 Firefox)。

https://www.ssllabs.com/ssltest/analyze.html?d=alooga.com.br

关于ubuntu - Nginx 将 http 子域重定向到 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30764640/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com