# Mulitiple rails application with different domain name

**URL:** <https://www.ruby-forum.com/t/mulitiple-rails-application-with-different-domain-name/178854>\
**Category:** Mongrel\
**Created:** [November 12, 2009, 11:04am UTC](https://www.ruby-forum.com/t/mulitiple-rails-application-with-different-domain-name/178854 "2009-11-12T11:04:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![geethasg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dbc845/32.png) [@geethasg](https://www.ruby-forum.com/u/geethasg)\
**Post date:** [November 12, 2009, 11:04am UTC](https://www.ruby-forum.com/t/mulitiple-rails-application-with-different-domain-name/178854/1 "2009-11-12T11:04:18Z")

</div>

I am using Slackware 12.1 OS, I need to deploy two rails applications  
(mongrel) with two different domain name with single ip.

for example,

maths.exam.info - path is /srv/maths.com/www/

grammar.exam.info - path is /srv/grammar.com/www

Herewith I’ve attached the apache conf files, please find it.

The problem is both the domain goes to maths.exam.info  
we could get both sites where mention the port number.

maths.exam.info:8000

grammar.exam.info:8003

How can i get the both sides with out port numbers.

The dns has registered properly.

Thanks  
sg…

---

<div class="post-metadata">

**Author:** ![geethasg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dbc845/32.png) [@geethasg](https://www.ruby-forum.com/u/geethasg)\
**Post date:** [November 12, 2009, 2:27pm UTC](https://www.ruby-forum.com/t/mulitiple-rails-application-with-different-domain-name/178854/2 "2009-11-12T14:27:44Z")

</div>

More or less you like it:  
Apache with proxy pass - [Apache configuration to remember (only one mongrel) · GitHub](http://gist.github.com/232869)  
Apache with proxy balancer - [Apache with mongrel\_cluster configuration to remember · GitHub](http://gist.github.com/232872)

Choose one and modify to your needs 🙂

Geetha Sg wrote:

> Herewith I’ve attached the apache conf files, please find it.  
> The dns has registered properly.
> 
> Thanks  
> sg..
> 
> Attachments:  
> [http://www.ruby-forum.com/attachment/4228/apache1.conf.rtf](http://www.ruby-forum.com/attachment/4228/apache1.conf.rtf)

–  
Rafa

---

<div class="post-metadata">

**Author:** ![geethasg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dbc845/32.png) [@geethasg](https://www.ruby-forum.com/u/geethasg)\
**Post date:** [November 12, 2009, 2:31pm UTC](https://www.ruby-forum.com/t/mulitiple-rails-application-with-different-domain-name/178854/3 "2009-11-12T14:31:15Z")

</div>

On Thu, Nov 12, 2009 at 2:04 AM, Geetha Sg [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I am using Slackware 12.1 OS, I need to deploy two rails applications  
> (mongrel) with two different domain name with single ip.

> The problem is both the domain goes to maths.exam.info  
> we could get both sites where mention the port number.
> 
> maths.exam.info:8000
> 
> grammar.exam.info:8003
> 
> How can i get the both sides with out port numbers.

Configure your virtual hosts properly; ServerName should be e.g.  
maths.exam.info and grammer.exam.info.

Also, both vhosts are forwarding to the same mongrel cluster, so  
nothing will ever get to the application on port 8003.

HTH,

---

<div class="post-metadata">

**Author:** ![geethasg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dbc845/32.png) [@geethasg](https://www.ruby-forum.com/u/geethasg)\
**Post date:** [November 13, 2009, 10:32am UTC](https://www.ruby-forum.com/t/mulitiple-rails-application-with-different-domain-name/178854/4 "2009-11-13T10:32:55Z")

</div>

Hassan S. wrote:

> On Thu, Nov 12, 2009 at 2:04 AM, Geetha Sg [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I am using Slackware 12.1 OS, I need to deploy two rails applications  
> > (mongrel) with two different domain name with single ip.
> 
> > The problem is both the domain goes to maths.exam.info  
> > we could get both sites where mention the port number.
> > 
> > maths.exam.info:8000
> > 
> > grammar.exam.info:8003
> > 
> > How can i get the both sides with out port numbers.
> 
> Configure your virtual hosts properly; ServerName should be e.g.  
> maths.exam.info and grammer.exam.info.
> 
> Also, both vhosts are forwarding to the same mongrel cluster, so  
> nothing will ever get to the application on port 8003.
> 
> HTH,

hi,

let me know how to do that.. i am very basic of ruby hosting..

---

<div class="post-metadata">

**Author:** ![geethasg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dbc845/32.png) [@geethasg](https://www.ruby-forum.com/u/geethasg)\
**Post date:** [November 13, 2009, 12:57pm UTC](https://www.ruby-forum.com/t/mulitiple-rails-application-with-different-domain-name/178854/5 "2009-11-13T12:57:29Z")

</div>

Rafael GarcÃ­a wrote:

> Geetha Sg wrote:
> 
> > > > maths.exam.info:8000
> > > 
> > > HTH,
> > 
> > hi,
> > 
> > let me know how to do that.. i am very basic of ruby hosting..
> 
> I give you two templates that you can use to configure your server  
> replacing “foo” with your data, and the ports with your mongrel ports.
> 
> If you don’t understand something it’s explained in apache documentation  
> very well: [Apache HTTP Server Version 2.2 Documentation - Apache HTTP Server Version 2.2](http://httpd.apache.org/docs/2.2/)
> 
> Regards!
> 
> –  
> Rafa

should i create the apache\_vhost\_mongrel\_cluster.conf for both  
applications

I’m using slackware os.

pls help

---

<div class="post-metadata">

**Author:** ![geethasg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dbc845/32.png) [@geethasg](https://www.ruby-forum.com/u/geethasg)\
**Post date:** [November 13, 2009, 12:11pm UTC](https://www.ruby-forum.com/t/mulitiple-rails-application-with-different-domain-name/178854/6 "2009-11-13T12:11:26Z")

</div>

Geetha Sg wrote:

> > > maths.exam.info:8000
> > 
> > HTH,
> 
> hi,
> 
> let me know how to do that.. i am very basic of ruby hosting..

I give you two templates that you can use to configure your server  
replacing “foo” with your data, and the ports with your mongrel ports.

If you don’t understand something it’s explained in apache documentation  
very well: [Apache HTTP Server Version 2.2 Documentation - Apache HTTP Server Version 2.2](http://httpd.apache.org/docs/2.2/)

Regards!

–  
Rafa

---

<div class="post-metadata">

**Author:** ![geethasg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/dbc845/32.png) [@geethasg](https://www.ruby-forum.com/u/geethasg)\
**Post date:** [November 13, 2009, 2:14pm UTC](https://www.ruby-forum.com/t/mulitiple-rails-application-with-different-domain-name/178854/7 "2009-11-13T14:14:21Z")

</div>

Geetha Sg wrote:

> > >
> 
> pls help

I recommend you to try the simple vhost example gist, after I you need  
more try the other “complex” gist.

I suposse that you’re using this file as vhost configuration file(I find  
it there in my slackware):

```
    /etc/httpd/extra/httpd-vhosts.conf

```

You can paste this code ( I don’t tested it but you get the idea and  
perhaps works fine):

NameVirtualHost \*:80

\<VirtualHost \*:80\>  
ServerName maths.exam.info  
DocumentRoot /srv/maths.com/www

ProxyPass / [http://127.0.0.1:8000/](http://127.0.0.1:8000/)

\<VirtualHost \*:80\>  
ServerName grammar.exam.info  
DocumentRoot /srv/grammar.com/www

ProxyPass / [http://127.0.0.1:8003/](http://127.0.0.1:8003/)

I personally (and many people) separate vhosts for domains or  
applications.  
But in your case do it when you understand how it works and what do  
every directive(apache doc for it).

Remember: www directory should be a rails\_root/public link

–  
Rafa
