I have setup my Rails app on a VPS and a WordPress blog on GoDaddy. I did this because I don’t want to have to install PHP on my VPS. Also, my rails app is using Postgres and while I am aware that WordPress can be setup to use Postgres, I just don’t want to go through the hassle.
How do I link the blog and my rails app, such that the blog is located at:
www.mysite.com/blog
Also, when internally navigating on the blog, the base URL should remain www.mysite.com/blog
For example:
www.mysite.com/blog/article1
www.mysite.com/blog/category
And so on….
Assuming that your Rails site runs with an Apache in front, here is something you can put into the
VirtualHost
part of your Rails site:In Nginx it would look like this
Of course I would recommend, that you add some more options to the proxy setup so that the IP address of the original requester is kept etc. Doing it this way, the Webserver already catches the request and doesn’t even bother your Rails app with requests that it doesn’t really know about.
to redirect correctly, but not hide the url of the wordpress site
in your rails app’s routes.rb
Make sure you didn’t forget to add http/https in your redirection url
Another alternative is to use a subdomain (instead of a subfolder), like
blog.mysite.com
, and then it can be handled using plain and simple dns.