如何在具有SSL和域的AWS中部署React和Django [英] How to deploy react and django in aws with a ssl and a domain

查看:42
本文介绍了如何在具有SSL和域的AWS中部署React和Django的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我在AWS EC2服务器中部署了react(端口80和443)和Django(端口8000).我购买了域和标准ssl证书.它在react(443)中设置.

Currently, I deployed react (port 80 & 443) and django (port 8000) in aws ec2 server. I bought a domain and standard ssl cert. It sets up in react (443).

在react的服务器连接中,它使用axios并连接到domain:8000,但我认为这不是一个好的解决方案.Safari无法连接到这种连接.因此,我添加了一个子域:api.domain并将连接从domain:8000更改为api.domain.由于我没有通配符ssl证书,因此https会阻止我在服务器中的api.domain连接.

In the server connection of react, it is using axios and connect to domain:8000 but I think it's not a good solution. Safari cannot connect to this kind of connection. Therefore, I add a subdomain: api.domain and change the connection from domain:8000 to api.domain. Since I don't have wildcard ssl cert, so https blocks my api.domain connection in the server.

此案的最佳做法是什么?

What is the best practice of this case?

推荐答案

最后,通过使用nginx将内部端口路由到外部端口进行了修复

Finally, fixed by using nginx to route the internal ports to external ports

这篇关于如何在具有SSL和域的AWS中部署React和Django的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆