Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine Octopress and a Rails 4.0 Application?

I understand that Octopress is designed to run as a standalone web application.

I have a personal website, and I want to add a blog to it, and for numerous reasons I would like to use Octopress for this. Rather than having two separate applications and repos in git, I would like to integrate these apps together.

Is there a reliable way to integrate Octopress into an existing Rails 4.0 application?

Would my best bet be to mount Octopress as a rack application inside the Rails router, or is there a better way?

like image 916
professormeowingtons Avatar asked Jul 04 '13 08:07

professormeowingtons


1 Answers

I think your best bet is to have a frontend server like nginx as a reverse proxy and do the redirecting/proxying from there.

So you will have an nginx.conf something along the lines of:

server {
  listen 80;
  server_name domain.com;
  location / {
    # ... proxy config stuff to rails ...
  }
}

server {
  listen 80;
  server_name blog.mydomain.com;
  location / {
    root /to/octopress/static/folder
  }
}

My example is if you use a subdomain blog.domain.com. But obviously if you have domain.com/blog, it will still work, just do some tweaking on the nging.conf file.

like image 64
westoque Avatar answered Nov 01 '22 15:11

westoque