最终效果是将

  • http://www.timeout.moe
  • https://www.timeout.moe
  • http://timeout.moe

全部跳转至 https://timeout.moe

需要为 https://www.timeout.moe 单独添加一个 server 块。
以下是示例。

server {
    server_name www.timeout.moe timeout.moe;
    return 301 https://timeout.moe$request_uri;
}

server {
    listen 443 ssl;
    ssl_certificate /path/to/server.cert;
    ssl_certificate_key /path/to/server.key;
    server_name www.timeout.moe;
    return 301 https://timeout.moe$request_uri;
}

server {
    listen 443 ssl;
    ssl_certificate /path/to/server.cert;
    ssl_certificate_key /path/to/server.key;
    server_name timeout.moe;

    <locations for processing requests>
}

参考来源

标签: none

添加新评论