Title: Issue with SSL when using nginx reverse proxy
Last modified: June 19, 2019

---

# Issue with SSL when using nginx reverse proxy

 *  [cshabazian](https://wordpress.org/support/users/cshabazian/)
 * (@cshabazian)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/issue-with-ssl-when-using-nginx-reverse-proxy/)
 * I’ve got a brand new WP site up and running, and it works just fine over http
   through my nginx reverse proxy. The problem comes when I secure it (using LetsEncrypt).
   I’ve configured both the nginx configuration file and the wp-config.php files
   to get it to work (seemingly), but it won’t let me login. The site displays just
   fine over https, but when I try to logon, it says invalid user or password. The
   same credentials work just fine over http.
 * Additions to 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’]; }
 * Additions to nginx conf file:
    location / { … proxy_set_header X-Forwarded-Host
   $host; proxy_set_header X-Forwarded-Proto $scheme; … }

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [williamchangnpu](https://wordpress.org/support/users/williamchangnpu/)
 * (@williamchangnpu)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/issue-with-ssl-when-using-nginx-reverse-proxy/#post-11807839)
 * I have the same issue
 *  [ahenriksson](https://wordpress.org/support/users/ahenriksson/)
 * (@ahenriksson)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/issue-with-ssl-when-using-nginx-reverse-proxy/#post-12369545)
 * I had the same issue, here’s a link on how to solve it:
    [https://ahenriksson.com/2020/01/27/how-to-set-up-wordpress-behind-a-reverse-proxy-when-using-nginx/](https://ahenriksson.com/2020/01/27/how-to-set-up-wordpress-behind-a-reverse-proxy-when-using-nginx/)
 *  [attzonko](https://wordpress.org/support/users/attzonko/)
 * (@attzonko)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/issue-with-ssl-when-using-nginx-reverse-proxy/#post-12420275)
 * [@ahenriksson](https://wordpress.org/support/users/ahenriksson/) Your link gives
   502 error. Is your site down? Can you paste the solution here?
 *  [alpik](https://wordpress.org/support/users/alpik/)
 * (@alpik)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/issue-with-ssl-when-using-nginx-reverse-proxy/#post-12420938)
 * got this from the google cache on that page:
 * > After getting your SSL-certificate and have enabled HTTPS redirection in NGINX,
   > WordPress will not work due to mixed content (HTTP and HTTPS) – you won’t be
   > able to login.
   > In order to fix this you first have to add this at the very start of your wp-
   > config.php.
   > define(‘FORCE_SSL_ADMIN’, true);
   >  if ($_SERVER[‘HTTP_X_FORWARDED_PROTO’] ==‘
   > https’) $_SERVER[‘HTTPS’]=’on’; Then in the end of the file add the following,
   > replacing “website.com” with your own URL.
   > define(‘WP_HOME’,’[https://website.com&#8217](https://website.com&#8217););
   > 
   > define(‘WP_SITEURL’,’[https://website.com&#8217](https://website.com&#8217););
   > Finally you have to add the following to your NGINX-config.
   > proxy_set_header X-Forwarded-Proto https;
   >  Now it should be working! You should
   > probably also add the plugin Really Simple SSL for their mixed content fixer.
 *  [ahenriksson](https://wordpress.org/support/users/ahenriksson/)
 * (@ahenriksson)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/issue-with-ssl-when-using-nginx-reverse-proxy/#post-12421328)
 * [@attzonko](https://wordpress.org/support/users/attzonko/) Oops! It’s up again.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Issue with SSL when using nginx reverse proxy’ is closed to new replies.

## Tags

 * [HTTPS](https://wordpress.org/support/topic-tag/https/)
 * [login](https://wordpress.org/support/topic-tag/login/)
 * [nginx](https://wordpress.org/support/topic-tag/nginx/)
 * [proxy](https://wordpress.org/support/topic-tag/proxy/)
 * [SSL](https://wordpress.org/support/topic-tag/ssl/)

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 5 replies
 * 3 participants
 * Last reply from: [ahenriksson](https://wordpress.org/support/users/ahenriksson/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/issue-with-ssl-when-using-nginx-reverse-proxy/#post-12421328)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
