Running Wordpress behind a reverse SSL proxy

15th Jun 2017

Newer versions of Wordpress really don't need much to get working behind an SSL proxy.

I currently have an NGINX webserver running infront of this blog. The job of NGINX here is to handle the SSL traffic, decrypt it, and forward it onto the docker container that runs this blog in plain old http.

If you're going to do this, you need to make sure your NGINX config is setup to send the right headers through to wordpress, so that wordpress knows about the scheme the traffic came in on. So, in your NGINX config file, you'll need the following:

location / { 
proxy_pass http://127.0.0.1:5030;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
}

That should be all you need. Wordpress has been around, and older blog posts seem to indicate that you may need some additional plugins. I didn't find that this was the case. Hope this helps.