In the following steps we will create a Rasbperry Pi IoT Server with Nodejs, Express, Socket.io, Nginx, PM2 and Dataplicity as a secure VPN tunnel.
Video
https://www.raspberrypi.org/downloads/
Video
https://www.nodesource.com/
https://github.com/nodesource/distributions
git clone https://github.com/prichardsondev/RaspberryPiServer.git
cd RaspberryPiServer
npm i
node app.js
sudo apt-get install nginx
sudo rm /etc/nginx/sites-enabled/default
sudo nano /etc/nginx/sites-available/node
server {
listen 80;
server_name localhost;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass "http://127.0.0.1:3000";
}
}
sudo ln -s /etc/nginx/sites-available/node /etc/nginx/sites-enabled/node
sudo service nginx restart
Video
https://www.dataplicity.com/
sudo npm install pm2 -g
pm2 start app.js
pm2 startup
run script from 'pm2 startup'
pm2 save