Sharing this because maybe there are many people like me who struggling how to deploy nuxt ssr to cpanel.so, here is the steps:
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:
npm run installto install all your deps
npm run buildyou can skip if you're already build it.
npm install pm2to install pm2 process manager
npx pm2 start npm --name "nuxtjs" --interpreter bash -- startto 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>
change your port with the actual port that your app use.
sorry if my explanation not that good. But I hope you get what I mean.