Changed config path for server to use local env files.
This commit is contained in:
@@ -5,22 +5,21 @@ ssh-keygen -t rsa -C "your_email@example.com"
|
||||
Copy the new key to clipboard:
|
||||
* Windows: clip < id_rsa.pub
|
||||
* Linux: sudo apt-get install xclip
|
||||
xclip -sel clip < ~/.ssh/id_rsa.pub
|
||||
xclip -sel clip < ~/.ssh/id_rsa.pub
|
||||
* Mac: pbcopy < ~/.ssh/id_rsa.pub
|
||||
* Manual Copy: cat ~/.ssh/id_rsa.pub
|
||||
|
||||
Add the SSH key to the drop creation screen.
|
||||
|
||||
|
||||
1. Create a new user to replace root user
|
||||
1. # adduser bob
|
||||
2. # usermod -aG sudo bob
|
||||
3. # su - bob
|
||||
1. # adduser imex
|
||||
2. # usermod -aG sudo imex
|
||||
3. # su - imex
|
||||
4. $ mkdir ~/.ssh
|
||||
5. $ chmod 700 ~/.ssh
|
||||
6. $ nano ~/.ssh/authorized_keys
|
||||
7. Add the copied SSH key and save.
|
||||
8. $ chmod 600 ~/.ssh/authorized_keys #Restrict access to authroized keys.
|
||||
8. $ chmod 600 ~/.ssh/authorized_keys #Restrict access to authorized keys.
|
||||
2. Setup the Firewall
|
||||
1. $ sudo ufw allow OpenSSH.
|
||||
2. $ sudo ufw enable
|
||||
@@ -43,20 +42,20 @@ Add the SSH key to the drop creation screen.
|
||||
8. Setup PM2
|
||||
1. $ npm install pm2 -g
|
||||
2. copy the environment variables to the local .env file.
|
||||
3. $ pm2 start server.js
|
||||
3. $ pm2 start ecosystem.config.js
|
||||
4. $ pm2 startup ubuntu //Ensure it starts when server does.
|
||||
9. Alter Nginx config
|
||||
1. sudo nano /etc/nginx/sites-available/default
|
||||
2. Add Appropriate server names to the file. www. and non-www.
|
||||
3. Add the following inside the location block:
|
||||
proxy_pass http://localhost:{{YOUR-APP-PORT-IN-YOUR-CODE}};
|
||||
1. sudo nano /etc/nginx/sites-available/default
|
||||
2. //Add Appropriate server names to the file. www. and non-www.
|
||||
3. Add the following inside the location of the server block:
|
||||
proxy_pass http://localhost:5000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
9. Install Certbot
|
||||
1. $ sudo add-apt-repository ppa:certbot/certbot
|
||||
1. $ sudo add-apt-repository ppa:certbot/certbot //Potential issue on ubuntu 20.04
|
||||
2. $ sudo apt-get update
|
||||
3. $ sudo apt install python-certbot-nginx
|
||||
4. $ sudo nano /etc/nginx/sites-available/default
|
||||
@@ -70,3 +69,8 @@ Add the SSH key to the drop creation screen.
|
||||
1. $ sudo certbot --nginx -d example.com -d www.example.com //Follow prompts.
|
||||
2. $ sudo certbot renew --dry-run //Dry run to test auto renewal.
|
||||
|
||||
|
||||
ADding Yarn
|
||||
curl -sL 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-get update && sudo apt-get install yarn
|
||||
Reference in New Issue
Block a user