DEV Community

Cover image for Deploying NUXT SSR to CPanel
hadezuka
hadezuka

Posted on • Edited on

Deploying NUXT SSR to CPanel

Sharing this because maybe there are many people like me who struggling how to deploy nuxt ssr to cpanel.so, here is the steps:

1. Create basic node app on cpanel
first, create node app on cpanel. You can find it on
Software - Setup Node.js App then fill the input like follows:
Alt Text

2. Upload your nuxt project
after creating the app, next step is upload your nuxt project into your folder that you've been specified on step 1.

3. Setting up
you can either using ssh or terminal. here i am using terminal on cpanel. to do so, copy the command from Enter to the virtual environment. Then go to cpanel dashboard -> terminal.
paste that command there, and execute the following commands:

  1. npm run install to install all your deps
  2. npm run build you can skip if you're already build it.
  3. npm install pm2 to install pm2 process manager
  4. npx pm2 start npm --name "nuxtjs" --interpreter bash -- start to run the "nuxtjs" app using pm2. "nuxtjs" is your app name.

4. Setting the .htaccess
after that, now you need to add this code to your .htaccess on public_html if it's not subdomain, or on the specified folder if subdomain:



Options +FollowSymLinks -Indexes 

IndexIgnore * 

 DirectoryIndex 
 <IfModule mod_rewrite.c> 
 RewriteEngine on 
 RewriteRule ^(.*)$ http://localhost:<your Port>/$1 [P] 
 </IfModule>


Enter fullscreen mode Exit fullscreen mode

change your port with the actual port that your app use.

Done!
sorry if my explanation not that good. But I hope you get what I mean.

More of my articles.

Top comments (10)

Collapse
 
ridoananda profile image
ridoananda

kalau gak ada SSH nya bisa bang?

Collapse
 
dzulqurnain profile image
hadezuka

Biasanya ada terminal di cpanelnya. Bisa lewat situ.

Collapse
 
ridoananda profile image
ridoananda

oke thanks infonya

Thread Thread
 
dzulqurnain profile image
hadezuka

Oke..

Collapse
 
slidenerd profile image
slidenerd

ec2 please, havent seen a single post on it

Collapse
 
dzulqurnain profile image
hadezuka

i am not using ec2, so I cant give any info for the moment. :)

Collapse
 
addin profile image
Akhul Syaifudin
Collapse
 
peterramsis profile image
peterramsis • Edited

How can I find a port? Please explain by video

Collapse
 
pudgeline profile image
Abolhasan Momeni

How did you solve your problem?

Collapse
 
barenmaulana profile image
baren maulana

makasih banyak, konten nya membantu saya