[Tutorial] Setup SvelteKit Application on CyberPanel/OpenLiteSpeed

Step 1: Install CyberPanel and Create Website

You first need to install CyberPanel and create your website . Skip this step if you have already done so. You can also issue SSL for this website.

I will be using svelte.mydomain.com as my example for this so change this to whatever your website domain is.

Step 2: Install Node.js via Command Line

Next step is to install Node.js via command line, a simple tutorial can be found here and refer to Option 2 on the tutorial webste.

Step 3: Setup a Reverse Proxy

Follow this tutorial on how to Reverse Proxy a website then continue below.

Step 4: Setup AppServer Context to Serve SvelteKit Application

Open website launcher by visiting https:// < IP Address >:8090/websites/svelte.mydomain.com and click vHost conf to add the following context configurations, make sure this is on your backend website where your server files are located.

context / {
  type                    appserver
  location                /home/svelte.mydomain.com/public_html/backend
  binPath                 /usr/bin/node
  appType                 node
  maxConns                100
 
  rewrite  {
 
  }
  addDefaultCharset       off
}

Step 5: Start SvelteKit Application

In my case i goto where my website files are located on my backened and type in this order:

npm install
npm run build
cd build
pm2 start index.js

Once all these steps are done you should have a working SvelteKit Application ran through a Reverse Proxy :slight_smile:

1 Like