Last active
November 10, 2019 02:33
-
-
Save makeitaboldmove/b603f1e72ffed8ce9bad3d3768f0ab94 to your computer and use it in GitHub Desktop.
Fresh Ubuntu, NodeJS, LetsEncrypt, Etc. Installation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# THIS IS OUT OF DATE, PLEASE FIND ANOTHER GIST OR TUTORIAL. | |
# Update Ubuntu and Packages | |
sudo apt-get update | |
sudo apt-get dist-upgrade -y | |
sudo apt-get upgrade -y | |
# Install NGINX | |
sudo apt-get install nginx -y | |
cd /etc/nginx/sites-enabled | |
sudo rm default | |
sudo nano default | |
# NGINX Config (Paste Into `default`) | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
server_name sub.domain.com; | |
root /var/www/html; | |
index index.php index.html index.htm index.nginx-debian.html; | |
location ~ /.well-known { | |
allow all; | |
} | |
} | |
# Restart NGINX | |
sudo nginx -t | |
sudo service nginx restart | |
# Install LetsEncrypt | |
sudo apt-get install software-properties-common -y | |
sudo add-apt-repository ppa:certbot/certbot -y | |
sudo apt-get update | |
sudo apt-get install python-certbot-nginx -y | |
# Get LetsEncrypt Cert | |
sudo certbot certonly --webroot -w /var/www/html -d sub.domain.com | |
# Uninstall NGINX | |
sudo service nginx stop | |
sudo apt-get remove nginx -y | |
# Install NodeJS | |
sudo apt-get install nodejs -y | |
sudo apt-get install npm -y | |
sudo apt-get install build-essential -y | |
cd /usr/share/nodejs/ | |
sudo npm init | |
sudo npm install --save pm2 -g -y | |
sudo npm install --save mariasql -y | |
sudo npm install --save express -y | |
sudo npm install --save body-parser -y | |
cd /usr/share/ | |
sudo chown -R changethisuser:www-data nodejs | |
# Start NodeJS | |
sudo pm2 start app.js -i max | |
sudo pm2 startup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment