-
-
Save nguyenkiidu/0f208659cb76525d8d81efaf5e44437a to your computer and use it in GitHub Desktop.
Wordpress behind NGINX reverse proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location /blog/ { | |
#auth_basic "Restricted"; | |
#auth_basic_user_file /etc/nginx/.htpasswd; | |
proxy_pass https://test-blog.bitstarz.com/; | |
proxy_set_header X-Forwarded-Host $host; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Proxy fix | |
define( 'WP_SITEURL', '/blog' ); | |
define( 'WP_HOME', '/blog' ); | |
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']; | |
} | |
$_SERVER['REQUEST_URI'] = "/blog".$_SERVER['REQUEST_URI']; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment