# Rails production version not accessible from other machines

**URL:** <https://www.ruby-forum.com/t/rails-production-version-not-accessible-from-other-machines/150296>\
**Category:** Rails\
**Created:** [October 7, 2008, 2:07am UTC](https://www.ruby-forum.com/t/rails-production-version-not-accessible-from-other-machines/150296 "2008-10-07T02:07:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![amrita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@amrita](https://www.ruby-forum.com/u/amrita)\
**Post date:** [October 7, 2008, 2:07am UTC](https://www.ruby-forum.com/t/rails-production-version-not-accessible-from-other-machines/150296/1 "2008-10-07T02:07:18Z")

</div>

Hi,

I just deployed my first rails application in production mode using  
Capistrano and mongrel clusters. Here are the lines in my  
mongrel\_cluster.yml file.

cwd: /myrailsdeploymath/current  
log\_file: log/mongrel.log  
port: “8000”  
environment: production  
address: [myserver.mydomain.org](http://myserver.mydomain.org)  
id\_file: tmp/pids/mongrel.pid  
servers: 3

My development and production machine are the same.  
When I run `cap deploy`, I can view my application perfectly well at:

[http://myserver.mydomain.org:8000/app](http://myserver.mydomain.org:8000/app)

from my own machine “myserver”.

However, I am unable to access the application from other computers on  
the intranet. The ports are open. I tested the development version on  
ports 8000, 8001, and 8002, using both WeBrick and Mongrel and I can  
access the application from other machines in the development mode.

But this doesn’t happen in the production mode. I get a “This URL is  
valid, but the connection was refused” error.

Does anyone know why this is happening? I have already spent a lot of  
time trying to get at the cause of this problem.

Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![amrita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@amrita](https://www.ruby-forum.com/u/amrita)\
**Post date:** [October 7, 2008, 3:00am UTC](https://www.ruby-forum.com/t/rails-production-version-not-accessible-from-other-machines/150296/2 "2008-10-07T03:00:32Z")

</div>

On Oct 7, 1:06 am, amrita [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> address: [myserver.mydomain.org](http://myserver.mydomain.org)  
> However, I am unable to access the application from other computers on  
> the intranet. The ports are open. I tested the development version on  
> ports 8000, 8001, and 8002, using both WeBrick and Mongrel and I can  
> access the application from other machines in the development mode.

Almost certainly mongrel cluster is binding the app to localhost (ie  
is only accessible at the address 127.0.0.1).

You shouldn’t be accessing the mongrels directly - typicall an  
instance of apache, nginx etc… sits between browsers and the  
mongrels, load balancing across them.

Fred

---

<div class="post-metadata">

**Author:** ![amrita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@amrita](https://www.ruby-forum.com/u/amrita)\
**Post date:** [October 7, 2008, 3:18am UTC](https://www.ruby-forum.com/t/rails-production-version-not-accessible-from-other-machines/150296/3 "2008-10-07T03:18:42Z")

</div>

Actually, I checked that by changing the address in  
mongrel\_cluster.yml. When I set the address to [myserver.mydomain.com](http://myserver.mydomain.com),  
I can only access it at that address and not at 127.0.0.1 and vice-  
versa from my computer. In either case, the site is not accessible  
from other computers.

Ultimately, I plan to use Apache for load balancing the mongrels. When  
I do that, will the binding of the app to localhost create a problem?

For now, is there some way of making the app available from other  
computers?

Thanks!

---

<div class="post-metadata">

**Author:** ![amrita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@amrita](https://www.ruby-forum.com/u/amrita)\
**Post date:** [October 7, 2008, 3:27am UTC](https://www.ruby-forum.com/t/rails-production-version-not-accessible-from-other-machines/150296/4 "2008-10-07T03:27:29Z")

</div>

On Mon, Oct 6, 2008 at 6:17 PM, amrita [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Ultimately, I plan to use Apache for load balancing the mongrels. When  
> I do that, will the binding of the app to localhost create a problem?

No, so why wait? 🙂

Installing Apache httpd is about a 5-minute job. For that matter, you  
could also install mod\_rails – so now it’s, maybe, 8-10 minutes –  
and dump the mongrels…

## FWIW,

Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![amrita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@amrita](https://www.ruby-forum.com/u/amrita)\
**Post date:** [October 7, 2008, 3:29am UTC](https://www.ruby-forum.com/t/rails-production-version-not-accessible-from-other-machines/150296/5 "2008-10-07T03:29:50Z")

</div>

Yes 🙂 already doing it. Installed Apache and now configuring  
httpd.conf. Will post an update soon, either ways. Thanks a ton guys!

---

<div class="post-metadata">

**Author:** ![amrita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@amrita](https://www.ruby-forum.com/u/amrita)\
**Post date:** [October 7, 2008, 5:43am UTC](https://www.ruby-forum.com/t/rails-production-version-not-accessible-from-other-machines/150296/6 "2008-10-07T05:43:50Z")

</div>

OK, I loaded the Mongrels onto Apache and got it working.

But one thing still beats me. Why is it that when Mongrel is running  
in a development environment, the pages are accessible from all  
computers on the intranet, whereas in production mode, mongrel-served  
pages are only visible from localhost?

Amrita

---

<div class="post-metadata">

**Author:** ![amrita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@amrita](https://www.ruby-forum.com/u/amrita)\
**Post date:** [October 7, 2008, 2:53pm UTC](https://www.ruby-forum.com/t/rails-production-version-not-accessible-from-other-machines/150296/7 "2008-10-07T14:53:27Z")

</div>

Can you post your /etc/hosts files from both development and  
production?  
Bharat

---

<div class="post-metadata">

**Author:** ![amrita](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/dc4da7/32.png) [@amrita](https://www.ruby-forum.com/u/amrita)\
**Post date:** [October 7, 2008, 8:11pm UTC](https://www.ruby-forum.com/t/rails-production-version-not-accessible-from-other-machines/150296/8 "2008-10-07T20:11:54Z")

</div>

Here is the /etc/hosts file. Both production and dev are on the same  
machine. OK, so I get why 127.0.0.1 and [myserver.mydomain.org](http://myserver.mydomain.org) are not  
mapped to one another. For that I will need to have a line  
“127.0.0.1 [myserver.mydomain.org](http://myserver.mydomain.org) myserver” in /etc/hosts.  
But the dev/prod accessibility problem is still unresolved.

127.0.0.1 localhost  
127.0.1.1 [myserver.mydomain.org](http://myserver.mydomain.org) myserver

# The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback  
fe00::0 ip6-localnet  
ff00::0 ip6-mcastprefix  
ff02::1 ip6-allnodes  
ff02::2 ip6-allrouters  
ff02::3 ip6-allhosts
