Skip to content

Instantly share code, notes, and snippets.

@wesleyserafim
wesleyserafim / install-certbot.sh
Last active May 24, 2018 21:26
Install Certbot and Certbot-Nginx-Plugin
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
sudo certbot --nginx
@wesleyserafim
wesleyserafim / create-swap.sh
Created May 24, 2018 21:08
Create Swap config
sudo fallocate -l 1G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
free -h
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
@wesleyserafim
wesleyserafim / nginx-default-php
Created May 18, 2018 21:16
Configuração do PHP no Nginx
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
client_max_body_size 20M;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
@wesleyserafim
wesleyserafim / lnmp.sh
Last active May 24, 2018 21:35
Deploy Stack Lnmp
!#/bin/bash/
sudo apt-get update
echo '### Instalando Web Server Nginx ###'
sudo apt-get install -y nginx
nginx -v
echo '### Instalando Mysql'
sudo apt-get install -y mysql-server
mysql -v
echo '### Prepearando para instalar a última versão do PHP ###'
sudo add-apt-repository ppa:ondrej/php
@wesleyserafim
wesleyserafim / letsencrypt_2017.md
Created May 17, 2018 20:14 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.