NGINX Reverse Proxy configuration for WordPress running on apache with http

January 2, 2018 366 views
WordPress CentOS

Hi, I have tried with the above configuration in my environment with plain http connection for apache/wordpress, it is not working for me. My configuration details are as below.
nginx:
proxypass http://upstream/$requesturi;
proxysetheader X-Forwarded-Host $host;
proxysetheader X-Forwarded-Proto $scheme;

apache .htaccess:

BEGIN WordPress

RewriteEngine On
RewriteBase /blog/
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUESTFILENAME} !-f
RewriteCond %{REQUEST
FILENAME} !-d
RewriteRule . /blog/index.php [L]

wp-config.php:
if ( (!empty( $SERVER[‘HTTPXFORWARDEDHOST’])) || (!empty( $SERVER[‘HTTPXFORWARDEDFOR’])) ) {
$_SERVER[‘HTTPS’] = ‘on’;
}

When I am hitting nginx URL, apache/WordPress port is appearing in the browser URL as https://host-one:8080/blog/ instead https://host-one:9443/blog (My Nginx https port is 9443). Can you please advise, what is missing in my configuration. Thanks.

Be the first one to answer this question.