我在子域上有一个注册页面,例如: https://signup.example.com
它应该只能通过 HTTPS 访问,但我担心人们可能会以某种方式通过 HTTP 偶然发现它并获得 404。
我在 nginx 中的 html/server 块如下所示:
html {
server {
listen 443;
server_name signup.example.com;
ssl on;
ssl_certificate /path/to/my/cert;
ssl_certificate_key /path/to/my/key;
ssl_session_timeout 30m;
location / {
root /path/to/my/rails/app/public;
index index.html;
passenger_enabled on;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我可以添加什么以便去的人http://signup.example.com
被重定向到https://signup.example.com
?(仅供参考,我知道有些 Rails 插件可以强制使用,SSL
但希望避免这种情况)