# PM2
# PM2
Command | Task |
---|---|
sudo npm install pm2 -g | Installed as global |
sudo pm2 start hello.js | Run |
sudo pm2 startup ubuntu | Autorun application on boot or crashes |
sudo pm2 list/ls/status | Status |
pm2 --name /<app_name/> | Specify an app name |
pm2 restart app_name | |
pm2 reload app_name | |
pm2 stop app_name | |
pm2 delete app_name | |
pm2 / | Instead of app_name we can use all/ID for commands like restart,reload, stop & delete |
pm2 start npm -- start | Run npm script put space after -- |
pm2 monit | To view process Monitor |
pm2 describe n | Display information about a specific process |
pm2 flush | Empty all log files |
pm2 logs n | Display logs in streaming about a specific process |
# Plesk=>Github=>Bitbucket
Step | Description | Where | Command |
---|---|---|---|
01 | Add Github repository | api.cloudapmc.com | Go to Github Icon & Select option Remote Git hosting |
02 | Copy clone URL | bitbucket.com | 01 Click clone Button 02 Select SSH instead of HTTPS 03 Copy the url |
03 | Complete the remaining options | api.cloudapmc.com | 01 Paste the URL into Remote Git Repository 02 Select the Deployment ode : Automatic / Manual / No Deployment 03 Select document root for the website |
04 | Copy Public Key | api.cloudapmc.com | It will automatically display SSH Public Key copy the key |
05 | Adding Key | bitbucket.com | 01 Go to Bitbucket Repository / Setting / Access Keys / Add Key 02 Label = domain 03 Key = ssh-rsa ..... |
06 | Finished the task | api.cloudapmc.com | 01 Click OK this will finished the task 02 Go to Gitrepository Setting copy ebhootk URL Note : https://server.cloudapmc.com:8443....Note (opens new window) : If the domain is not available please add A record for it. |
07 | Adding Webhook | bitbucket.com | 01 Go To Bitbucket / Settings / Webhooks / Add Webhook 02 title : domain 03 url : https://server.cloudapmc.com:8443 (opens new window)... 04 status : Active 05 keep rest option default |
# General Settings
Description | Command |
---|---|
Create alias for www-root | vim ~/.bashrc |
Check Open Ports | netstat -tulpn |
Find out running process on Port | netstat -plan |
Kill Process running on specific port | kill $(lsof -t -i :5000) |
check free & available memory | free -h |
# Plex Setings : Enabled Gzip Response
Serve static files directly by nginx
ac3 avi bmp bz2 css cue dat doc docx dts eot exe flv gif gz htm html ico img iso jpeg jpg js mkv mp3 mp4 mpeg mpg ogg pdf png ppt pptx qt rar rm svg swf tar tgz ttf txt wav woff woff2 xls xlsx zip webp
1
Additional nginx directives
gzip on;
gzip_disable "MSIE [1-6]\\.(?!.\*SV1)";
gzip_proxied any;
gzip_comp_level 5;
gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application/rss+xml text/javascript image/x-icon image/bmp image/svg+xml;
gzip_vary on;
1
2
3
4
5
6
2
3
4
5
6
# SSL Certificate
copy cert.pem & privkey.pem to ssl folder of your application folder
cp /usr/local/psa/var/modules/letsencrypt/etc/live/[MyDomain]/privkey.pem .
cp /usr/local/psa/var/modules/letsencrypt/etc/live/[MyDomain]/cert.pem .
1
2
2
# Domain
# Change NS records
- In some cases you need to create child record and then add it to NS record.
- In some case you need to add IP = NS1,NS2 and then add it as NS record.
# Shell Script to deploy site
password="?"
username="?"
Ip="?"
clear
echo "Current date : $(date) @ $(hostname)"
echo "Stage 1 => compressing file"
rm -rf wiki.zip
cd dist
zip -rq ../wiki.zip .
echo "Stage 2 Begin => Uploading file"
sshpass -p $password scp ../wiki.zip $username@$Ip:/paht/
echo "Stage 2 Complete => Uploading file"
echo "Stage 3 => Deploying Site"
sshpass -p $password ssh -t -t $username@$Ip << EOF
cd /path/;
find . \! -name 'wiki.zip' -delete ;
unzip -qq wiki.zip >/dev/null;
ls -lh;
EOF
echo "Process Completed"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
← Linux Virtual Machine →