Deploy Strapi on cPanel


Hi, I try to deploy my strapi project on cpanel. I use the “Setup Node.js App” software, but I can’t run “strapi develop”. I upload my files and everything work except the CONTENT-TYPE BUILDER because it needs to start the server with “strapi develop”. I tried to use the option “Run The Script” on cpanel but I wait 20 minutes now and nothing change. I am a beginner with strapi so I am not sure what is wrong

2 Likes

I have been struggling with setting up my Strapi project on Cpanel myself. Can’t even see the login or create user page.

2 Likes

Hey did you get any solution yet?

I find a semi-solution, use VSCode and connect ssh with it to webhost/cpanel then stop app(because conflict) run strapi (npm run develop[package.json script]) on localhost:port (ex:localhost:1337 on your webhost) use port forwarding and forward the port 1337 then you can open in your browser from localmachine
for more info : Connect over SSH with Visual Studio Code

deploy without Setup Node.js Deploy Node.js Apps To Shared Hosting - YouTube

1 Like

Cpanel on default creates a ‘app.js’ file on the directory root
if not create a js file and set it as application startup file

open that file and remove everything and replace with this:

const strapi = require('@strapi/strapi');

if (process.env.NODE_ENV == "development")
    strapi({"autoReload": { "enabled": true }}).start();
else
    strapi().start();

now if you set your application mode to development you will be able to use content-type builder [ cuz I added that condition in the script ] :wink:

now you can save and start the app and everything will work as expected. you can now create category while in development mode

2 Likes

perform a npm run build in your local environment. after that copy the build file to cpanel node app root directory.

your solution was amazing, thank you

1 Like

Hey apostolis_dimitriou, im curently trying to host the admin panel on Cpanel but the error “500 internal servor” can you show me all you need to make strapi working in developement and Production please ?

Thank you in advance !

hi there

i’ve copied the build folder onto cpanel root directory in my case i’ve created a folder called ‘admin’.
When i go to that url mydomian/admin, i get error “Warning An error occurred while requesting the API” and nothing happens just the loading spinner spinning forever.

any help is much appreciated,

thanks in advance

Hi, Can you please share the steps on how you were able to deploy strapi on cpanel.
There are few things i am struggling with such as:

  1. Running strapi with SSL.
  2. Running strapi in nginx with reverse proxy virtual host (while Apache is enabled).
  3. Running it on 1337 port while serving proxy on 443 to achieve SSL communication.

I don’t have CloudLinux so i am using legacy Application Manager with Phusion Passenger. I tried multiple settings for HOST IP (127.0.0.1:1337 & PUBLICIP:1337). It runs the container but can’t get it to serve on my https://subdomain.domain.com

So how do you run build in the live server whiles your development environment is set to development in cPanel

Hi, Can you fix error “503 internal server” on cpanel production mode? I,m same.

hi did you got a solution ? i have the same issue

hi i had the same probleme please did you find a solution ?

have you eventually managed to solve the 503 error?