# Discourse Docker + Other Rails App on the same droplet

**URL:** https://meta.discourse.org/t/discourse-docker-other-rails-app-on-the-same-droplet/23673
**Category:** Self-hosting
**Tags:** hosting
**Created:** [2015 年1 月 5 日 07:23 UTC](https://meta.discourse.org/t/discourse-docker-other-rails-app-on-the-same-droplet/23673 "2015-01-05T07:23:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chrisalley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisalley/32/119703_2.png) [@chrisalley](https://meta.discourse.org/u/chrisalley)
#### Post date: [2015 年1 月 5 日 07:23 UTC](https://meta.discourse.org/t/discourse-docker-other-rails-app-on-the-same-droplet/23673/1 "2015-01-05T07:23:36Z")

</div>

I already have a Discourse installation set up on Digital Ocean with Docker using the [beginner guide](https://github.com/discourse/discourse/blob/master/docs/INSTALL-digital-ocean.md). I wish to put a second Rails app on the same droplet. I see that there’s a similar discussion in [this topic](https://meta.discourse.org/t/what-is-the-best-method-of-running-another-rails-app-on-the-same-server-as-discourse/9623) and [this other topic](https://meta.discourse.org/t/hosting-other-ruby-on-rails-app-side-by-side-with-discourse/17610) but no specific solution described in detail.

The sites need to be set up like this:

Other Rails App: [http://www.mysite.com](http://www.mysite.com) and [http://mysite.com](http://mysite.com)  
Discourse Docker: [http://forums.mysite.com](http://forums.mysite.com)

Alternatively a seperate droplet could be used for the other Rails app, but if possible I would like to configure nginx to have them on the same droplet. I’m just not sure how to configure nginx to point to both the Docker Discourse app and a regular Rails app. Any pointers would be appreciated. This seems like it would be a common configuration worth documenting here.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2015 年1 月 6 日 05:00 UTC](https://meta.discourse.org/t/discourse-docker-other-rails-app-on-the-same-droplet/23673/2 "2015-01-06T05:00:05Z")

</div>

In general you would use [haproxy](http://www.haproxy.org/) for this kind of work.

You run haproxy on the bare metal and then have it split out requests to the various domains you are hosting.

---

<div class="post-metadata">

### Author: ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)
#### Post date: [2015 年1 月 6 日 09:15 UTC](https://meta.discourse.org/t/discourse-docker-other-rails-app-on-the-same-droplet/23673/3 "2015-01-06T09:15:36Z")

</div>

It is also doable with nignx as well, using multiple server {} blocks, and matching the proxy by server\_name.

something like:

```
server {
  listen 80;
  server_name www.mysite.com;
  location / {
    proxy_pass http://localhost:4567/; #your rails app port
  }
}
server {
  listen 80;
  server_name forums.mysite.com;
  location / {
    proxy_pass http://localhost:8080/; #your discourse port as seen by the host
  }
}

```

---

<div class="post-metadata">

### Author: ![chrisalley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisalley/32/119703_2.png) [@chrisalley](https://meta.discourse.org/u/chrisalley)
#### Post date: [2015 年1 月 14 日 06:37 UTC](https://meta.discourse.org/t/discourse-docker-other-rails-app-on-the-same-droplet/23673/4 "2015-01-14T06:37:59Z")

</div>

> [@awole20](#):
>
> proxy\_pass [http://localhost:4567/](http://localhost:4567/); #your rails app port

How is the local Rails app port number configured (using nginx and passenger)?
