29th November 2023

Learn to deploy Subsequent js to cPanel. Our cPanel Help staff is right here that can assist you together with your questions and issues.

Deploy Subsequent js to cPanel

Are you able to deploy a Subsequent.js utility utilizing cPanel with somewhat assist from our specialists?

How to Deploy Next js to cPanel

  1. To start with, we’ve got to arrange a customized Subsequent.js server. So, create a `server.js` file in our venture’s root listing and add the required code. Right here’s a have a look at what our `server.js` may appear to be:

    const { createServer } = require('http')
    const { parse } = require('url')
    const subsequent = require('subsequent')
    const dev = course of.env.NODE_ENV !== 'manufacturing'
    const hostname = 'localhost'
    const port = 3000
    const app = subsequent({ dev, hostname, port })
    const deal with = app.getRequestHandler()
    app.put together().then(() => {
    createServer(async (req, res) => {
    strive {
    const parsedUrl = parse(req.url, true)
    const { pathname, question } = parsedUrl
    if (pathname === '/a') {
    await app.render(req, res, '/a', question)
    } else if (pathname === '/b') {
    await app.render(req, res, '/b', question)
    } else {
    await deal with(req, res, parsedUrl)
    } catch (err) {
    console.error('Error occurred dealing with', req.url, err)
    res.statusCode = 500
    res.finish('inside server error')
    .as soon as('error', (err) => {
    course of.exit(1)
    .hear(port, () => {
    console.log(`> Prepared on http://${hostname}:${port}`)

  2. Then, edit the venture’s `bundle.json` file to set the setting to manufacturing on the beginning script. This script ought to run the `server.js` file we created within the earlier step.
  3. At this level, we’ve got to construct our Subsequent.js utility. That is accomplished by operating the `npm run construct` or `yarn run construct` command within the terminal.
  4. Subsequent, open the Subsequent.js venture within the file supervisor. If we are able to’t see hidden information, we are able to allow visibility in our file supervisor settings.
  5. Then, log in to the cPanel webhosting and add and extract the ZIP file with our Subsequent.js venture information to the area title’s root folder.

Now, head to the Software program part of cPanel and click on “Setup Node.js App”. Then, click on the “+ Create Utility” button and observe the setup directions. As soon as every little thing is in place, click on on “CREATE.” Our Subsequent.js app will routinely begin, and we’re good to go.

[Need assistance with a different issue? Our team is available 24/7.]


In short, our Help Specialists demonstrated the best way to deploy Subsequent.js to cPanel.


By no means once more lose prospects to poor server velocity! Allow us to make it easier to.

Our server specialists will monitor & keep your server 24/7 in order that it stays lightning quick and safe.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.