简体   繁体   English

在 Jelastic 中部署 Next.js

[英]Deploying Next.js in Jelastic

I have no experience with Next.js and its deployment.我没有使用 Next.js 及其部署的经验。 Our team has been developing an app in Next.js and I need to deploy it into our Jelastic platform.我们的团队一直在 Next.js 开发一个应用程序,我需要将它部署到我们的 Jelastic 平台中。 I am very much familiar with Apache server and haven't used any other servers than that.我对 Apache 服务器非常熟悉,除此之外没有使用过任何其他服务器。

I found out that Next.js can't be deployed with Apache (or at least static export is not the best idea).我发现 Next.js 不能与 Apache 一起部署(或者至少 static 导出不是最好的主意)。 So, I created a Node.js server environment in Jelastic and I have no idea how to make the application accessible.因此,我在 Jelastic 中创建了一个 Node.js 服务器环境,但我不知道如何使该应用程序可访问。 I read the Next.js documentation and it says that the production build files after next build are stored inside .next folder but I didn't find any entry point files (as in Apache) such as index.html in that folder.我阅读了 Next.js 文档,它说next build后的生产构建文件存储在.next文件夹中,但我没有在该文件夹中找到任何入口点文件(如在 Apache 中),例如index.html

I tried running next start and a server was started on localhost on port 3000, but I couldn't access that remotely.我尝试运行next start并在端口 3000 上的 localhost 上启动了一个服务器,但我无法远程访问它。

I didn't find much about Next.js deployment in different environments anywhere.我没有在任何地方的不同环境中找到太多关于 Next.js 部署的信息。 I am probably missing several things here, but I am clueless.我可能在这里遗漏了几件事,但我一无所知。 How do I deploy and run Next.js application in Jelastic?如何在 Jelastic 中部署和运行 Next.js 应用程序?

Basically, port 3000 is not open on the firewall side on the NodeJS nodes that Virtuozzo provides.基本上,端口 3000 在 Virtuozzo 提供的 NodeJS 节点的防火墙端没有打开。 I think the server would have been accessible if you had opened the corresponding port through the dashboard.我认为如果您通过仪表板打开相应的端口,服务器就可以访问了。 You can test if your application is accessible from the NodeJS node by doing a "curl localhost:3000".您可以通过执行“curl localhost:3000”来测试您的应用程序是否可以从 NodeJS 节点访问。

Otherwise, I think the best way to make your application accessible from the outside is to use your NodeJS node as you do, but add a loadbalancer NGinx node in front of it.否则,我认为让你的应用程序可以从外部访问的最好方法是像你一样使用你的 NodeJS 节点,但在它前面添加一个 loadbalancer NGinx 节点。 Change the configuration provided to point to port 3000 and not 80 of your NodeJS node.更改提供的配置以指向 NodeJS 节点的端口 3000 而不是 80。 This should be enough.这应该足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM