Skip to content

Instantly share code, notes, and snippets.

@TizioFittizio
Last active July 29, 2020 11:38
Show Gist options
  • Save TizioFittizio/4fe8b83fa8cb256e0786affc84dc4484 to your computer and use it in GitHub Desktop.
Save TizioFittizio/4fe8b83fa8cb256e0786affc84dc4484 to your computer and use it in GitHub Desktop.
# Updated on 23/01/2020 from https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04
# Installing nginx
sudo apt update
sudo apt install nginx
# Sample configuration
server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
server_name ***.com www.***.com;
server_tokens off;
location / {
proxy_pass http://127.0.0.1:3000;
}
location /api/ {
proxy_pass http://127.0.0.1:8421;
}
}
## Add link in sites-enabled
sudo ln -s ../sites-available/***.com ***.com
# Let's encrypt
sudo add-apt-repository ppa:certbot/certbot
sudo apt install python-certbot-nginx
sudo certbot --nginx -d ***.com -d www.***.com
sudo certbot renew --dry-run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment