how to deploy nextJs app in cpanel #12234
-
Hi all!
this is my package.json file: |
Beta Was this translation helpful? Give feedback.
Replies: 16 comments 43 replies
-
I'm facing a similar problem. How do deploy the NextJs app to shared hosting with cPanel. The instructions indicate to define a Node app and define a strtup file like 'app.js'. The problem is that a build of NextJs does not have any startup file ! Hoe to worlaround this ? |
Beta Was this translation helpful? Give feedback.
-
Hello, info - Creating an optimized production build .events.js:174 I thought it was because of env variables (reported in cpanel interface), so I create an .env.local file like on my localhost, but it still doesn't work. Any help would be so great..! :) |
Beta Was this translation helpful? Give feedback.
-
@okozolin, I've tried the simple example of next : [https://github.com/vercel/next.js/tree/master/examples/custom-server-express] and I get the same problem : `info - Creating an optimized production build
npm ERR! A complete log of this run can be found in: The complete log : I am on a shared hosting, could it be because of virtual env ? In the project directory (public_html) the node_modules created is a link to a nodevenv directory. It seems that next does build but at the end maybe it fails because next can't manage node_modules directory's link ? (Thank you so much for your reply !;) |
Beta Was this translation helpful? Give feedback.
-
It is working, thank you ! 😊 |
Beta Was this translation helpful? Give feedback.
-
hello I'm having a strange issue. with React it was pretty simple to deploy the app on shared hosting, but with next.js it became problematic. i get the forbidden error when I put my .next file in server directory. I've been using this server for over a year now. . . Has anyone found a working method to deploy nexj.js build(.next) on a custom server? |
Beta Was this translation helpful? Give feedback.
-
Hello, here is my server.js const { createServer } = require('http'); const dev = process.env.NODE_ENV !== 'production'; const port = parseInt(process.env.PORT, 10) || 3000; // Create the Express-Next App app
}); and my script: |
Beta Was this translation helpful? Give feedback.
-
Road map for deploying on cPanel Next App with server side rendering (not only static) :
package.json with the start command :
|
Beta Was this translation helpful? Give feedback.
-
Successfully deployed in shared hosting with following steps:
|
Beta Was this translation helpful? Give feedback.
-
I have deployed my next js project on netlify with custom server. But after deployment the custom server wouldn't run so I added this in my package.json and added the build command npm run export , now the server starts but the build isn't completed. |
Beta Was this translation helpful? Give feedback.
-
error showing need help ready - started server on 0.0.0.0:3000, url: http://localhost:3000 |
Beta Was this translation helpful? Give feedback.
-
When I trying to deploy my next app in my cpanel and click the run npm install its give an error "An error occured during installation of modules. The operation was performed, but check availability of application has failed. Web application responds, but its return code "None" or content type before operation "text/html" doesn't equal to contet type after operation "text/html; charset=utf-8". " |
Beta Was this translation helpful? Give feedback.
-
doesn't it still work for app folder Nextjs 13? |
Beta Was this translation helpful? Give feedback.
-
thank you
শুক্র, ১১ আগ, ২০২৩ তারিখে ১১:১৭ PM টায় তারিখে Ishu Sharma <
***@***.***> লিখেছেন:
… try using vercel if you can it's already a managed setup and free to use.
this is basic but you will need the following.
node installed -> any version supported by your Next distro
some kind of server to reverse proxy the node connections ( nginx or
apache dosen't really matter what you go with )
once done it should all work.
in case if you want to expose node directly you will need the access to
the IP tables and ufw on your linux distro.
use ufw to expose the node on port 80 and you should be gucchi. just be
ware if you do that you will be responsibe to handle all 400 , 404 , 401
etc with success responses.
third solution is just use docker with node and nginx gateway copy your
image on the server and expose the port to the internet
I personally think 1st and third is the best choice.
—
Reply to this email directly, view it on GitHub
<#12234 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATB3T7OIE4NLIIKMWYQSQODXUZSLBANCNFSM4MRZD5TA>
.
You are receiving this because you commented.Message ID: <vercel/next.
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I deployed it and it's working but the issue I am facing is my data is coming from contentful [ the blogs and projects section is dynamic ] and my contact forms are connected with nodemailer these two are not working after I deployed it. even I set up the node js application and env variables there, my hosting provider support node js |
Beta Was this translation helpful? Give feedback.
-
i'm using next v15 and it works well by starting the app this way: require("next"); i build locally and push .next folder ... |
Beta Was this translation helpful? Give feedback.
I'm facing a similar problem. How do deploy the NextJs app to shared hosting with cPanel. The instructions indicate to define a Node app and define a strtup file like 'app.js'. The problem is that a build of NextJs does not have any startup file ! Hoe to worlaround this ?