Skip to content

Instantly share code, notes, and snippets.

@lcuevastodoit
Created July 12, 2020 00:10
Show Gist options
  • Save lcuevastodoit/acdb3ce34b1363eff8e1bea468321ddc to your computer and use it in GitHub Desktop.
Save lcuevastodoit/acdb3ce34b1363eff8e1bea468321ddc to your computer and use it in GitHub Desktop.
sudo apt-get install nginx
sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https
sudo ufw allow 4000
sudo ufw enable
yes
systemctl status nginx
sudo nano /etc/nginx/sites-available/default
sudo nano /var/www/html/index.nginx-debian.html
sudo systemctl restart nginx
sudo mkdir -p /var/www/mydomain.com/html
sudo chown -R $USER:$USER /var/www/mydomain.com/html
sudo chmod 755 /var/www/mydomain.com
-------------------------------------------------------
sudo nano /var/www/mydomain.com/html/index.html
<html>
<body>
<h1> Hello Wordl </h1>
</body>
</html>
--------------------------------------------------------
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/mydomain.com
----------------------------------------------
sudo nano /etc/nginx/sites-available/mydomain.com
remove all the "default-server" strings
modify to "root /var/www/mydomain.com/html;"
modify to "server_name mydomain.com www.mydomain.com"
and save
------------------------------------------
sudo ln -s /etc/nginx/sites-available/mydomain.com /etc/nginx/sites-enabled
------------------------------------
sudo nano /etc/nginx/nginx.conf
"optional uncomment" -> server_names_hash_bucket_size 64;
------------------------------------
sudo nginx -t
sudo systemctl restart nginx
-------------------------------------------
LetsEncrypt CERTBOT
sudo add-apt-repository ppa:certbot/certbot
sudo apt install -y python-certbot-nginx
sudo certbot --nginx -d mydomain.com -d www.mydomain.com
enter email : admin@mydomain.com
Agree : A
Share your email: Yes
after running some domain tests...
HTTPS: option 2
certificate is installed
sudo certbot renew --dry-run
sudo nginx -t
sudo systemctl restart nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment