Skip to content

Instantly share code, notes, and snippets.

@nanusdad
Last active January 19, 2023 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanusdad/4b2f6e12c6f6f1679c8cb76411b3803c to your computer and use it in GitHub Desktop.
Save nanusdad/4b2f6e12c6f6f1679c8cb76411b3803c to your computer and use it in GitHub Desktop.
Setting up NodeJS app with NGINX and MongoDB on Ubuntu 20.04

Setting up NodeJS app with NGINX and MongoDB on Ubuntu 20.04

  1. Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install --lts
  1. Install nginx
sudo apt update
sudo apt install nginx
sudo ufw app list
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'OpenSSH'
sudo ufw enable
sudo ufw app list
sudo ufw status

systemctl status nginx
  1. Install MongoDB
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt update
sudo apt install mongodb-org
sudo systemctl start mongod.service
sudo systemctl enable mongod
sudo systemctl status mongod
mongo --eval 'db.runCommand({ connectionStatus: 1 })'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment