amazon-web-services - aws ubuntu 16.04 服务器上的 HTTPS

标签 amazon-web-services ssl nginx https ubuntu-16.04

我安装了 AWS Ubuntu 16.04 实例,我在这台服务器上安装了 nginxphp7mysql,我分配 IP 地址并将其关联到此服务器,并在安全组上添加端口:443 和端口:80

我在此实例上安装了 Wordpress。

我在 namecheap 中有域,所以我在 aws 的 route53 中创建名称服务器条目,并在 namecheape.com 上更新它,现在我的 example.com 运行良好,我设法重定向 www.example.comexample.com。但是我无法将 http:// 转换为 https://,我在 google 上搜索但没有成功,我不知道从哪里开始以及该做什么.

最佳答案

要从 http 重定向到 https,有多种方法。一种方法是更改​​ nginx 配置

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

第二次监听是针对 ipv6 的。 您可以在此处查看服务器故障答案:https://serverfault.com/questions/67316/in-nginx-how-can-i-rewrite-all-http-requests-to-https-while-maintaining-sub-dom

关于amazon-web-services - aws ubuntu 16.04 服务器上的 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42022330/

相关文章:

html - Nginx CSS 和 JS 404

nginx - 用于实时流媒体的 MPEG-DASH 编码

regex - Nginx server_name 正则表达式不作为变量工作

mysql - 通过 MySQL Workbench 连接到 Amazon RDS

ssl - keytool -importkeystore 似乎不起作用

amazon-web-services - 用于 Lambda 的 AWS 状态机,cloudformation 语法

c# - Moon APNS 的未知错误 P12 文件

r - 使用 Ubuntu 20.04 LTS 中的 R download.file ("https://..") 时出现“SSL 连接错误”

mysql - 异步写入多个 MySQL 数据库

postgresql - 升级 Postgres Aurora 主版本