sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get dist-upgrade
sudo apt-get install build-essential
sudo apt-get install libssl-dev
sudo apt-get install git-core
sudo apt-get install python
Install nodejs:
sudo apt install nodejs
Install NPM and update to latest:
sudo apt install npm
sudo npm install -g npm@latest
Make a web folder:
cd ~
mkdir ~/www
cd ~/www
Install forever globally:
cd ~
sudo npm install -g forever
if you get this error npm does not support Node.js v10.19.0
, upgrade node:
curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
You can forward the port from 8081 to 80
export PORT=8081
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8081
Keep for future references - to remove iptable just use -D
sudo iptables -D PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8081
Install yarn:
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install yarn
Install Netstat to see open ports:
sudo apt install net-tools
sudo netstat -plunta | grep LISTEN
Restart server for updates to complete - All done :)
Clear all ip tables;
sudo iptables -F
sudo iptables -X
sudo iptables -t nat -F
sudo iptables -t nat -X
sudo iptables -t mangle -F
sudo iptables -t mangle -X
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
Set http / https port forwarding;
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8000
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8081
Setting openssl certificate;
http://greengeckodesign.com/blog/2013/06/15/creating-an-ssl-certificate-for-node-dot-js/
Create CSR for none self signed certificate: http://www.rackspace.com/knowledge_center/article/generate-a-csr-with-openssl
Hello world;