July 11, 2022

How To Redirect to HTTPS for WordPress with NGINX and SSL Certified by Bitnami and Automattic

After deploying the SSL certificate to the new WordPress virtual machine I still had to figure out how to redirect HTTP traffic to the secure HTTPS endpoint. Buried in the Bitnami support forums are the steps to easily update NGINX.

First, open the NGINX server block specific for WordPress. (Yes, I use pico)

sudo pico /opt/bitnami/nginx/conf/server_blocks/wordpress-server-block.conf

Once the conf file is open, look for the line "server_name _;" and right below that enter the one line below. The line will instruct NGINX to redirect port 80 (HTTP) traffic to HTTPS.

return 301 https://$host$request_uri;

Save the conf file. Use the next two commands to test config and restart NGINX.

sudo nginx -t
sudo /opt/bitnami/ctlscript.sh restart nginx

Visit your WordPress site at http://YOURDOMAIN and it will automatically forward to https://YOURDOMAIN.

FILED UNDER:  Google Cloud , WordPress

Connect to Google Cloud SQL with Cloud SQL Auth proxy and UNIX Sockets

Google Cloud SQL provides multiple ways for a developer to connect to a database externally for development or testing purposes.


How to Deploy WordPress with SSL on Google Cloud for Free

In a few hours, anyone, even those not well-versed in cloud computing or shell scripting, can deploy WordPress running SSL for free in Google Cloud.


How To Design, Develop, and Deploy Your Own Custom WordPress Theme

I get it; the custom design is not as popular as it was. But there are a few benefits to rolling your theme.