简体   繁体   中英

Deploying Next.js in Jelastic

I have no experience with Next.js and its deployment. Our team has been developing an app in Next.js and I need to deploy it into our Jelastic platform. I am very much familiar with Apache server and haven't used any other servers than that.

I found out that Next.js can't be deployed with Apache (or at least static export is not the best idea). So, I created a Node.js server environment in Jelastic and I have no idea how to make the application accessible. 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.

I tried running next start and a server was started on localhost on port 3000, but I couldn't access that remotely.

I didn't find much about Next.js deployment in different environments anywhere. I am probably missing several things here, but I am clueless. How do I deploy and run Next.js application in Jelastic?

Basically, port 3000 is not open on the firewall side on the NodeJS nodes that Virtuozzo provides. 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".

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. Change the configuration provided to point to port 3000 and not 80 of your NodeJS node. This should be enough.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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