Set up HTTPS using Let's Encrypt and NGINX

Publicado em: 01 Outubro 2020
no canal de: DevbaseMedia
8,801
179

We will finally set up HTTPS access on our Wordpress Docker instance running on Google Cloud Platform. Although this shows setup for Wordpress, this will work for anything running via an NGINX reverse proxy. As usual, everything demonstrated in this video is free; in this case the SSL/TLS certs are provided by LetsEncrypt.

Previous videos:
Registering a domain with Google Domains:    • How to transfer domains from GoDaddy to Go...  
Creating a Wordpress instance on GCP:    • Run Wordpress for Free Forever with Google...  
How to Point your Domain at a Google Cloud Instance:    • How to Point your Domain at a Google Cloud...  
Point an NGINX Reverse Proxy to Wordpress Running on Docker:    • Point an NGINX Reverse Proxy to Wordpress ...  



Commands to set up certbot:
sudo apt install software-properties-common && sudo apt update
sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install -y python-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
sudo service nginx restart



Code snippet for wp_config.php:
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS']='on';

if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
}

Code snippet for nginx configuration:
server {
root /var/www/html;
listen 80;
listen [::]:80;
server_name yourdomain.com www.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
}
}


GitHub repo: https://github.com/chrisbmatthews/wor...

Google Cloud Platform: https://cloud.google.com


Nesta página do site você pode assistir ao vídeo on-line Set up HTTPS using Let's Encrypt and NGINX duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário DevbaseMedia 01 Outubro 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 8,801 vezes e gostou 179 espectadores. Boa visualização!