gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 14:42:30 24 4
gpt4 key购买 nike

我安装了 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com