Skip to content

Instantly share code, notes, and snippets.

@suciuvlad
Last active July 8, 2017 07:46
Show Gist options
  • Save suciuvlad/a54058d8870f07aed3b6b944615b3447 to your computer and use it in GitHub Desktop.
Save suciuvlad/a54058d8870f07aed3b6b944615b3447 to your computer and use it in GitHub Desktop.
wordpress + cloudfront + ssl + reverse proxy
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
define('FORCE_SSL_ADMIN', true);
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
$_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
define('WP_HOME','https://www.mbitcasino.com/blog');
define('WP_SITEURL','https://www.mbitcasino.com/blog');
upstream blog {
server 159.203.163.215:80;
}
location /blog {
rewrite ^/blog/(.*)$ /$1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
proxy_pass http://blog;
proxy_redirect off;
}
location /wp-admin {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
proxy_pass http://blog;
proxy_redirect off;
}
@suciuvlad
Copy link
Author

Wordpress plugins used:

SSL Insecure Content Fixer
CloudFlare Flexible SSL
Cloudflare

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment