Wazone Panel and Node.js server Install (VPS + CloudPanel)

REQUIREMENTS:
– Ubuntu server 22.04 or Debian 11 (Others WILL NOT WORK!)
– CloudPanel v2.x
https://www.cloudpanel.io/docs/v2/introduction/
choose “others” if your hosting is not on the list

WAZONE ADMIN PANEL:
– Add sites
Admin panel -> choose PHP Site
Application: Generic (DO NOT choose others!)
Domain Name: admin.mydomain.com
PHP Version: PHP 8.1 (DO NOT choose others!)

– Click “Manage”
Vhost tab edit:
(look for this): try_files $uri $uri/ /index.php?$args;
(replace with this): try_files $uri $uri/ /index.php?$args /public/index.php?$args;

Databases tab: Add Database (please copy the database credentials)

SSL/TLS tab: Actions-> New Let’s Encrypt Certificate

File Manager tab: htdocs -> delete admin.mydomain.com folder -> upload wazone-admin-panel.zip -> extract to admin.mydomain.com

start installation by going to admin.mydomain.com (no “/public”) on your browser
Please follow install guide here: https://visimisi.net/docs/wazone-install-2-subdomains/

CRON JOB:
From Admin panel, open menu “Rest API”, activate license if you have not done so (you might need to de-activate license first from https://visimisi.net/my-account/).

Scroll all the way down copy the cron job command (example: /usr/local/bin/php /home/username/api.mydomain.com/artisan schedule:run >> /dev/null 2>&1)

Now we go back to CloudPanel to “Cron Jobs” tab, choose every minute and paste the command from above, but we edit it becomes:
php8.1 /home/username/admin.mydomain.com/artisan schedule:run >> /dev/null 2>&1
then click “Add Cron Job” button to save it.

WAZONE NODE.JS SERVER:
– Add sites
Node.js server -> choose Node.js Site
Domain Name: api.mydomain.com
Node.js Version: Node 14 LTS (DO NOT choose others!)
App Port: 8000
Site User: mydomain-api
Site User Password: xxxxxxxxxxxx
We will need this user and password for later, so copy it to somewhere safe.

– Click “Manage”
SSL/TLS tab: Actions-> New Let’s Encrypt Certificate

File Manager tab: htdocs -> delete api.mydomain.com folder -> upload wazone-nodejs-server.zip -> extract to api.mydomain.com

Open/create .env:
APP_URL=https://my-admin-panel.com
APP_PORT=8000

DB_CONNECTION=mysql
DB_HOST=your_server_private_ip (see pic below, example: 10.0.0.185)
DB_PORT=3306
DB_DATABASE=your-database-name
DB_USERNAME=your-database-username
DB_PASSWORD=your-database-password

TIMER_REFRESH=true

– Log in via SSH with your Site User:
ssh mydomain-api@your_public_ip_address
Use the username/password that we saved earlier above (mydomain-api/xxxxxxxxxxxx)

– Go to the root directory of your project:
cd htdocs/api.mydomain.com/

– Install the latest pm2 via npm.
npm install pm2@latest -g

– Use the following command to start your application via pm2:
pm2 start server.js

– To save the pm2 configuration, execute the save command:
pm2 save

– If your setup was correct, you will see a response if you go to: https://api.mydomain.com/info

– For a complete pm2 commands:
https://www.cloudpanel.io/docs/v2/nodejs/deployment/pm2/

Powered by BetterDocs