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 ...
Creating a Wordpress instance on GCP: • Run Wordpress for Free Forever with G...
How to Point your Domain at a Google Cloud Instance: • How to Point your Domain at a Google ...
Point an NGINX Reverse Proxy to Wordpress Running on Docker: • Point an NGINX Reverse Proxy to Wordp...
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
Смотрите видео Set up HTTPS using Let's Encrypt and NGINX онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь DevbaseMedia 01 Октябрь 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 8,363 раз и оно понравилось 174 людям.