【问题标题】:Always use https for domain? [closed]始终使用 https 作为域? [关闭]
【发布时间】:2016-01-01 07:03:11
【问题描述】:

我刚刚在 ec2 上设置了一个服务器,带有 nginx 的 ubuntu 和一个通过 namecheap(也提供我的域)的 ssl 证书。

当我点击https://example.com 时,证书就会出现。

如果用户要访问 www.example.com 或 http://example.com,我怎样才能使他们使用 https:// 连接?

【问题讨论】:

    标签: ssl amazon-web-services nginx amazon-ec2


    【解决方案1】:

    我认为以下应该可行:

    server {
      server_name example.com;
      listen 443 ssl default_server;
      # your https-specific config 
    }
    
    server {
      server_name example.com;
      listen 80;
      location / {
        return 301 https://example.com$request_uri;
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-09-15
      • 1970-01-01
      • 1970-01-01
      • 2015-01-28
      • 2011-01-20
      • 2012-11-12
      • 2017-12-22
      相关资源
      最近更新 更多