-
Notifications
You must be signed in to change notification settings - Fork 54
How to stream a WordPress blog through a Rack app
John Bachir edited this page Apr 27, 2017
·
7 revisions
- rack app is on https://example.com
- wordpress blog is on http://blog.example.com (not https)
- rack-reverse-proxy is being used to stream the blog through https://example.com/blog
using rack-reverse-proxy 1.0 (unreleased as of this writing. this was done using a4f28a6).
this example is for Rails, but you can easily adapt it to a general rack app
config.middleware.insert(0, Rack::ReverseProxy) do
reverse_proxy_options preserve_host: false
if Rails.env.production? or Rails.env.staging?
reverse_proxy_options force_ssl: true, replace_response_host: true
end
reverse_proxy /^\/blog(\/?.*)$/, 'http://blog.example.com/blog$1'
end
if apache or nginx root is /var/www/html, install wordpress in /var/www/html/blog
update wp_options set option_value = "https://example.com/blog" where option_name = "home" or option_name = "siteurl";
you might need to install this plugin: https://wordpress.org/plugins/ssl-insecure-content-fixer/
/etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
Redirect 404 /
ErrorDocument 404 "Page Not Found"
</VirtualHost>
<VirtualHost *:80>
ServerName example.com # the server identifies as example.com and expects that in the HOST header, but example.com DNS points to heroku
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>