Fil*_*nca 0 ubuntu ssl redirect rewrite nginx
我有一个包含 3 个子域的域:
- example.com(主域) - api.example.com - blog.example.com - support.example.com(只是一个指向 Zendesk 的 cname)
我的Nginx上有这 3 个配置:
接口
# 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.....
}
Run Code Online (Sandbox Code Playgroud)
博客
server {
listen 80;
server_name blog.example.com;
root /var/www/blog;
index index.php index.html index.htm;
Run Code Online (Sandbox Code Playgroud)
站点/主域
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;
.....
}
Run Code Online (Sandbox Code Playgroud)
我的问题:
您的 Web 服务器设置为Strict-Transport-Security max-age=16070400; includeSubdomains.
这将告诉 Web 浏览器仅使用 https 请求您的域。如果您希望blog通过不安全的 http 访问子域,您需要includeSubdomains从 HTTP 严格传输安全 (HSTS) 中删除并使用不同的浏览器(或清除您的 Firefox)。
https://www.ssllabs.com/ssltest/analyze.html?d=alooga.com.br