Rails deploy via Capistrano+Nginx conflicts with Apache?

I am hosting several static sites on my Linode which I've been managing with Apache. Recently did I build a Rails app that that I spent all weekend trying to get deployed to a custom domain. I tried everything and finally was able to see some success after following a Rails Screencast including a Capistrano deploy using Nginx and Unicorn.

I ran the deploy script from my home machine and it deployed files to my Linode at the appropriate web address (yay!). However, it looks like there is conflict with Apache, and my site is not serving up on the server. The files are simply "directory listing" contents.

The site is: http://www.ohinaa.com

App code is all on Github: http://www.github.com/indie/serenity

I can post config files, if needed. Hopefully it's something obvious I'm missing because I've spent too much time in the problem, and can't see it. Any help will be greatly GREATLY appreciated.

10 Replies

If you're trying to run nginx and apache on the same IP and port then it's going to fail, only one service can run on each ip/port combination.

Either replace apache with nginx or use nginx to proxy requests to apache http://wiki.nginx.org/HttpProxyModule

Thanks so much for the reply. I'm thinking there's a third option, which is probably the most simple and easiest: add another IP addy. [Edit] Lol, I just tried to purchase one via my account management dashboard, and it was like, "sorry you need technical justification for a second IP address" :)

You probably won't get it. You need to justify a reason for having an additional IP, pretty much the only reasons are failover and ssl certificates. (Unless you're only using ipv6 which is unlikely).

Actually, I do have an SSL cert which was obtained specifically for this site . . . haven't done anything with it (yet) because I've not been able to deploy the site at all.

Scratch NGINX. Now accepting other ideas. I need to leave my live sites alone and re-building everything on Nginx is just not an option I have time for right now. I'm trying to focus my efforts on this ONE SITE to get it working, not messing with load balancers and other riffraff. I do not have time for distractions this month.

I need a concrete example of something that will work and allow me to get this Rails app (which was extraordinarily difficult in and of itself to get to work beautifully on locahost) live on the Internet. This should not be so difficult. Can the config/deploy.rb script be modified to work with Passenger? I have not been able to find anything that shows a working example of this.

I'd probably suggest that a quick, simple, distractionless approach would be to just get another Linode and use it for the new app. Completely avoids any possible collision between the new and old sites.

That can then buy you some time (without pressure due to the new site being unavailable) to look into figuring out how to integrate your older sites and the new site on a single system. I do suspect it'll be easiest to use nginx on the front end (since it runs your dynamic site which tends to require more server-specific configuration) and proxy the older requests back to Apache. If your older sites are truly static, it may be just as easy to let nginx handle them directly as well.

But in any case, there's no need to solve that issue as a precursor to at least getting your new site online.

– David

I wish I could afford another Linode, but alas; there is a budget here, and I already prepaid my Linode for one year. Besides, that would be just SILLY, as my current Linode is running at something like 1 percent of capacity. To REQUIRE somebody like me to buy an entirely new Linode just to get another IP would be Evil.

I am sure that somebody somewhere has been able to figure out how to host mutiple static sites + one rails app with a Postgres DB on a single-server IP address managed by Apache. Passenger seemed kind of promising, but the Linode documentation on it is terrible and did not work.

There is a third option: run Nginx on a different port and configure Apache to serve as a reverse proxy to it using a ProxyPass directive or a rewrite rule with the P flag.

Here's an example of setting up an Apache reverse proxy for a non-Rails application; you may be able to find a guide more specific to your needs. Note that Nginx is usually used in front of Apache, not the other way around, so a lot of your search results will be for that configuration.

O.M.G., I finally, finally, finally got it working!

Nginx was a terrible idea.

=============================================

Dear Nginx:

You are far too Herculean for my tastes. Why can't you just let everybody do their own thing? Why do you try to run the whole show? I wasted so much precious time trying to get you to play nice, but that's just not something you seem to know how to do.

You're just too bossy. You shall be banished from my Linodes forever.

Love,

indie

=============================================

I ended up using Apache + a bleeding-edge "experimental" version of Passenger cloned from Github.

Will post details later. In the meantime, lemme just put this out there: I've learned the hard way to not listen to advice on forums, and just work with what I know.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct