{"id":18454,"date":"2025-01-14T13:31:58","date_gmt":"2025-01-14T13:31:58","guid":{"rendered":"https:\/\/truehost.com\/support\/?post_type=docs&#038;p=18454"},"modified":"2025-01-15T08:20:50","modified_gmt":"2025-01-15T08:20:50","password":"","slug":"how-to-deploy-nextjs-on-cpanel","status":"publish","type":"docs","link":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/","title":{"rendered":"How to deploy Nextjs on cPanel"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>Next.js is a powerful React framework that enables developers to build server-side rendered (SSR) and statically generated web applications. It offers features like automatic code splitting, optimized performance, and seamless API integration, making it a popular choice for modern web development. <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>However, deploying a <strong><code>Next.js <\/code><\/strong>app on a shared hosting platform like <code><strong>cPanel<\/strong><\/code> can be tricky, as it requires additional configuration compared to traditional static sites. This guide will walk you through the steps to deploy a Next.js app on cPanel.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><em><strong>NOTE<\/strong>: cPanel does <strong>NOT<\/strong> natively support Next.js. Thus additional steps are required to make it work.<\/em><\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<p>Next.js is built on top of Node.js, so it requires a Node.js environment to run. Ensure that your cPanel hosting supports Node.js applications before proceeding. Ensure that also the Node.js versions you need are available before proceeding. <\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Next.js and Node.js Supported Versions<\/strong><\/h2>\n\n\n\n<p>Before deploying your Next.js app, ensure that your Node.js version is compatible with the version of Next.js you are using. Refer to the&nbsp;<a href=\"https:\/\/nextjs.org\/docs\/pages\/building-your-application\/upgrading\" target=\"_blank\" rel=\"noreferrer noopener\">Next.js documentation<\/a>&nbsp;for the latest compatibility information. As of October 2023:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Next.js 13+ requires Node.js 16.8 or later.<\/li>\n\n\n\n<li>Next.js 12.x supports Node.js 12.22 or later.<\/li>\n\n\n\n<li><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Preparing a Next.js App for Deployment<\/strong><\/h2>\n\n\n\n<p>To deploy a Next.js app on cPanel, you need to:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Create a Custom Next.js Server (<code>server.js<\/code>)<\/strong><\/h3>\n\n\n\n<p>Next.js apps typically use the built-in server for development. However, for deployment on cPanel, you need to create a custom server. Follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create a\u00a0<code>server.js<\/code>\u00a0file in the root directory of your project.<\/li>\n\n\n\n<li>Add the following code to the file:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>const { createServer } = require('http');\nconst { parse } = require('url');\nconst next = require('next');\n\nconst dev = process.env.NODE_ENV !== 'production';\nconst hostname = 'localhost';\nconst port = process.env.PORT || 3000;\n\nconst app = next({ dev, hostname, port });\nconst handle = app.getRequestHandler();\n\napp.prepare().then(() => {\n  createServer(async (req, res) => {\n    try {\n      const parsedUrl = parse(req.url, true);\n      const { pathname, query } = parsedUrl;\n\n      if (pathname === '\/a') {\n        await app.render(req, res, '\/a', query);\n      } else if (pathname === '\/b') {\n        await app.render(req, res, '\/b', query);\n      } else {\n        await handle(req, res, parsedUrl);\n      }\n    } catch (err) {\n      console.error('Error occurred handling', req.url, err);\n      res.statusCode = 500;\n      res.end('Internal server error');\n    }\n  })\n    .once('error', (err) => {\n      console.error(err);\n      process.exit(1);\n    })\n    .listen(port, () => {\n      console.log(`> Ready on http:\/\/${hostname}:${port}`);\n    });\n});<\/code><\/pre>\n\n\n\n<p>See attached below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-63-1024x512.png\" alt=\"\" class=\"wp-image-18455\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-63-1024x512.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-63-300x150.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-63-768x384.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-63.png 1363w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This code sets up a custom server to handle requests and serve your Next.js app.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Modify the\u00a0<code>package.json<\/code>\u00a0File<\/strong><\/h3>\n\n\n\n<p>Update the\u00a0<code>package.json<\/code>\u00a0file to use the custom server for production. Add to the\u00a0<code>start<\/code>\u00a0script with the following:<\/p>\n\n\n\n<p><br><strong><code>\"start\": \"NODE_ENV=production node server.js\",<br><\/code><\/strong><\/p>\n\n\n\n<p>This ensures that the custom server (<code>server.js<\/code>) is used when the app is deployed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"464\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-64-1024x464.png\" alt=\"\" class=\"wp-image-18456\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-64-1024x464.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-64-300x136.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-64-768x348.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-64.png 1297w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Build the Next.js Application<\/strong><\/h3>\n\n\n\n<p>Before deploying, you need to build your Next.js app. Run the following command in your terminal:<\/p>\n\n\n\n<p><strong><code>npm run build<\/code><\/strong><\/p>\n\n\n\n<p>This generates an optimized production build of your app. <em><code>Ensure there are no errors during the build process. <\/code><\/em><\/p>\n\n\n\n<p>See Attached Image.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"517\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-65-1024x517.png\" alt=\"\" class=\"wp-image-18457\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-65-1024x517.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-65-300x151.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-65-768x388.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-65.png 1298w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Prepare Files for Deployment<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open your file manager or file explorer and locate your Next.js project files.<\/li>\n\n\n\n<li>Enable visibility for hidden files (if necessary).<\/li>\n\n\n\n<li>Exclude the following files and folders:\n<ul class=\"wp-block-list\">\n<li><code>node_modules<\/code><\/li>\n\n\n\n<li><code>.git<\/code><\/li>\n\n\n\n<li><code>README.md<\/code><\/li>\n\n\n\n<li><code>.gitignore<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Select all remaining files and folders, then create a ZIP archive.<\/li>\n<\/ol>\n\n\n\n<p>Excluding&nbsp;<code>node_modules<\/code>&nbsp;is important because it reduces the size of the deployment package. The necessary dependencies will be installed on the server later.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"357\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-66.png\" alt=\"\" class=\"wp-image-18458\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-66.png 709w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-66-300x151.png 300w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Deploying the Next.js App on cPanel<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 1: Configure the Node.js App in cPanel<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Log in to your cPanel account.<\/li>\n\n\n\n<li>Under the\u00a0<strong>Software<\/strong>\u00a0section, locate and click\u00a0<strong>Setup Node.js App<\/strong>.<\/li>\n\n\n\n<li>Click\u00a0<strong>+ CREATE APPLICATION<\/strong>.<\/li>\n\n\n\n<li>Configure the application settings:\n<ul class=\"wp-block-list\">\n<li><strong>Node.js version<\/strong>: Select the version that matches your local development environment.<\/li>\n\n\n\n<li><strong>Application mode<\/strong>: Select\u00a0<strong>Production<\/strong>.<\/li>\n\n\n\n<li><strong>Application root<\/strong>: Specify the directory where your app will be uploaded (e.g.,\u00a0<code>NextApp<\/code>).<\/li>\n\n\n\n<li><strong>Application URL<\/strong>: Choose your domain or subdomain.<\/li>\n\n\n\n<li><strong>Application startup file<\/strong>: Enter\u00a0<code>server.js<\/code>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>If you have environment variables, add them under the\u00a0<strong>Environment Variables<\/strong>\u00a0section.<\/li>\n\n\n\n<li>Click\u00a0<strong>CREATE<\/strong>\u00a0to create the Node.js application.<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"824\" height=\"382\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-67.png\" alt=\"\" class=\"wp-image-18459\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-67.png 824w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-67-300x139.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-67-768x356.png 768w\" sizes=\"auto, (max-width: 824px) 100vw, 824px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Creating the Application.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"530\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-68-1024x530.png\" alt=\"\" class=\"wp-image-18460\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-68-1024x530.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-68-300x155.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-68-768x398.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-68.png 1110w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Access your domain. You will notice it will load with a page saying &#8220;It Works!&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"297\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-71-1024x297.png\" alt=\"\" class=\"wp-image-18463\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-71-1024x297.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-71-300x87.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-71-768x223.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-71.png 1111w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Upload Files to cPanel<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>In cPanel, navigate to\u00a0<strong>File Manager<\/strong>.<\/li>\n\n\n\n<li>Go to the directory specified in the\u00a0<strong>Application root<\/strong>\u00a0field (e.g.,\u00a0<code>NextApp<\/code>).<\/li>\n\n\n\n<li>Click\u00a0<strong>Upload<\/strong>\u00a0and select the ZIP file you created earlier.<\/li>\n\n\n\n<li>After the upload is complete, right-click the ZIP file and choose\u00a0<strong>Extract<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"450\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-70-1024x450.png\" alt=\"\" class=\"wp-image-18462\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-70-1024x450.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-70-300x132.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-70-768x337.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-70.png 1362w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Extracted files. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"376\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-73-1024x376.png\" alt=\"\" class=\"wp-image-18465\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-73-1024x376.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-73-300x110.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-73-768x282.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-73.png 1360w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 3: Install Dependencies and Start the App<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go back to the\u00a0<strong>Node.js Setup<\/strong>\u00a0section in cPanel.<\/li>\n\n\n\n<li>Copy the command provided to activate the virtual environment.<\/li>\n\n\n\n<li>Open the <strong><code>Terminal<\/code><\/strong> on cPanel and paste the command to activate the virtual environment and navigate to the application root folder and run.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"837\" height=\"421\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-76.png\" alt=\"\" class=\"wp-image-18470\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-76.png 837w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-76-300x151.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-76-768x386.png 768w\" sizes=\"auto, (max-width: 837px) 100vw, 837px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Run the npm install command.<\/p>\n\n\n\n<p><strong><code>npm install<\/code><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"473\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-72-1024x473.png\" alt=\"\" class=\"wp-image-18464\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-72-1024x473.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-72-300x139.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-72-768x355.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-72.png 1126w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This installs the required dependencies.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Restart your application from the\u00a0<strong>Node.js Setup<\/strong>\u00a0section.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"575\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-74-1024x575.png\" alt=\"\" class=\"wp-image-18466\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-74-1024x575.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-74-300x169.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-74-768x431.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-74.png 1125w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 4: Access Your Deployed App<\/strong><\/h3>\n\n\n\n<p>Once the app is running, access it via your domain or subdomain. Your Next.js app should now be live!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"589\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-75-1024x589.png\" alt=\"\" class=\"wp-image-18467\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-75-1024x589.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-75-300x172.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-75-768x441.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-75.png 1218w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Troubleshooting.<\/strong><\/h2>\n\n\n\n<p>In case of issues, You can check the error logs in the<code><strong> stderr.log<\/strong><\/code> file generated by the Node Setup on the cPanel.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"382\" src=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-77-1024x382.png\" alt=\"\" class=\"wp-image-18474\" srcset=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-77-1024x382.png 1024w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-77-300x112.png 300w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-77-768x286.png 768w, https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-77.png 1366w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>Deploying a Next.js app on cPanel requires a few extra steps compared to traditional static sites, but it\u2019s entirely possible with the right configuration. <\/p>\n\n\n\n<p>By creating a custom server, building your app, and configuring the Node.js environment in cPanel, you can successfully deploy your Next.js app on shared hosting. <\/p>\n\n\n\n<p>If you encounter any issues, refer to the\u00a0<a href=\"https:\/\/nextjs.org\/docs\" target=\"_blank\" rel=\"noreferrer noopener\">Next.js documentation<\/a>\u00a0or consult with other developers for assistance. <\/p>\n\n\n\n<p>Happy Hosting! ?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Next.js is a powerful React framework that enables developers to build server-side rendered (SSR) and statically generated web applications. It offers features like automatic code splitting, optimized performance, and seamless API integration, making it a popular choice for modern web development. However, deploying a Next.js app on a shared hosting platform like cPanel can be [&hellip;]<\/p>\n","protected":false},"author":24,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_eb_attr":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"doc_category":[1822,1878],"doc_tag":[],"class_list":["post-18454","docs","type-docs","status-publish","hentry","doc_category-cpanel","doc_category-get-all-your-cpanel-help"],"year_month":"2026-06","word_count":945,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"Kibera","author_nicename":"dan-k","author_url":"https:\/\/truehost.com\/support\/author\/dan-k\/"},"doc_category_info":[{"term_name":"Cpanel","term_url":"https:\/\/truehost.com\/support\/docs-category\/cpanel\/"},{"term_name":"Cpanel","term_url":"https:\/\/truehost.com\/support\/docs-category\/get-all-your-cpanel-help\/"}],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to deploy Nextjs on cPanel -<\/title>\n<meta name=\"description\" content=\"Learn how to deploy a Next.js app on cPanel. Learn to set up a custom server, Node.js, and host your Next.js application on shared hosting.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to deploy Nextjs on cPanel -\" \/>\n<meta property=\"og:description\" content=\"Learn how to deploy a Next.js app on cPanel. Learn to set up a custom server, Node.js, and host your Next.js application on shared hosting.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-15T08:20:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-63-1024x512.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-nextjs-on-cpanel\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-nextjs-on-cpanel\\\/\",\"name\":\"How to deploy Nextjs on cPanel -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-nextjs-on-cpanel\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-nextjs-on-cpanel\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/image-63-1024x512.png\",\"datePublished\":\"2025-01-14T13:31:58+00:00\",\"dateModified\":\"2025-01-15T08:20:50+00:00\",\"description\":\"Learn how to deploy a Next.js app on cPanel. Learn to set up a custom server, Node.js, and host your Next.js application on shared hosting.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-nextjs-on-cpanel\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-nextjs-on-cpanel\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-nextjs-on-cpanel\\\/#primaryimage\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/image-63.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/image-63.png\",\"width\":1363,\"height\":681},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-deploy-nextjs-on-cpanel\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to deploy Nextjs on cPanel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#website\",\"url\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/\",\"name\":\"\",\"description\":\"Help In a Click\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#organization\",\"name\":\"Truehost Kenya\",\"url\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"width\":240,\"height\":48,\"caption\":\"Truehost Kenya\"},\"image\":{\"@id\":\"https:\\\/\\\/www.truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to deploy Nextjs on cPanel -","description":"Learn how to deploy a Next.js app on cPanel. Learn to set up a custom server, Node.js, and host your Next.js application on shared hosting.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/","og_locale":"en_US","og_type":"article","og_title":"How to deploy Nextjs on cPanel -","og_description":"Learn how to deploy a Next.js app on cPanel. Learn to set up a custom server, Node.js, and host your Next.js application on shared hosting.","og_url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/","article_modified_time":"2025-01-15T08:20:50+00:00","og_image":[{"url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-63-1024x512.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/","url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/","name":"How to deploy Nextjs on cPanel -","isPartOf":{"@id":"https:\/\/www.truehost.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/#primaryimage"},"image":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/#primaryimage"},"thumbnailUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-63-1024x512.png","datePublished":"2025-01-14T13:31:58+00:00","dateModified":"2025-01-15T08:20:50+00:00","description":"Learn how to deploy a Next.js app on cPanel. Learn to set up a custom server, Node.js, and host your Next.js application on shared hosting.","breadcrumb":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/#primaryimage","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-63.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2025\/01\/image-63.png","width":1363,"height":681},{"@type":"BreadcrumbList","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-deploy-nextjs-on-cpanel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.truehost.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to deploy Nextjs on cPanel"}]},{"@type":"WebSite","@id":"https:\/\/www.truehost.com\/support\/#website","url":"https:\/\/www.truehost.com\/support\/","name":"","description":"Help In a Click","publisher":{"@id":"https:\/\/www.truehost.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.truehost.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.truehost.com\/support\/#organization","name":"Truehost Kenya","url":"https:\/\/www.truehost.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.truehost.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","width":240,"height":48,"caption":"Truehost Kenya"},"image":{"@id":"https:\/\/www.truehost.com\/support\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/18454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/comments?post=18454"}],"version-history":[{"count":4,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/18454\/revisions"}],"predecessor-version":[{"id":18475,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/18454\/revisions\/18475"}],"wp:attachment":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/media?parent=18454"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_category?post=18454"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_tag?post=18454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}