Set up HTTPS using Let's Encrypt and NGINX

Pubblicato il: 01 ottobre 2020
sul canale di: 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


In questa pagina del sito puoi guardare il video online Set up HTTPS using Let's Encrypt and NGINX della durata di ore minuti seconda in buona qualità , che l'utente ha caricato DevbaseMedia 01 ottobre 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 8,801 volte e gli è piaciuto 179 spettatori. Buona visione!