WordPress website will not load CSS when using NGINX as a reverse proxy with SSL

When using NGINX as a reverse proxy with wordpress and having enabled SSL, you will have to force wordpress to forward HTTP to HTTPS.

First, setup your wordpress website and NGINX reverse proxy with SSL. You will notice that CSS will not load when you visit your domain, instead of localhost.

Add these lins to wp-config.php in your wordpress directory.

if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
        $_SERVER['HTTPS']='on';

Now, in the wordpress settings change your wordpress address and site address and point them to your domain.

This will solve your problem.

You can read more on the official wiki for wordpress.

Similar Posts