# Install Discourse as a subdirectory with existing Nginx

**URL:** https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710
**Category:** Self-hosting
**Created:** [October 28, 2018, 8:24pm UTC](https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710 "2018-10-28T20:24:32Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Mayus](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@Mayus](https://meta.discourse.org/u/Mayus)
#### Post date: [October 28, 2018, 8:24pm UTC](https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710/1 "2018-10-28T20:24:32Z")

</div>

Hello, I’m new to Discourse and would really like to have it on my server. I also have a nginx configuration that allows to connect to a wordpress website. I do not want to have a subdomain, I just want to have this URL: [snapecraft.ddns.net/forum](http://snapecraft.ddns.net/forum)  
Because my server doesn’t support PostgreSQL I decided to host the Database on an external free webserver.  
How would I do the nginx configuration and the configuration of the DB? Are there some guides?  
Thank you so much in advance.

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [October 28, 2018, 9:30pm UTC](https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710/2 "2018-10-28T21:30:14Z")

</div>

The first question to answer is whether you can run docker on that server. Do you have ssh access as root?

A subfolder install is fine with another instance of nginx but you will still need to install docker with nginx and postgres within the container.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 29, 2018, 12:20am UTC](https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710/3 "2018-10-29T00:20:53Z")

</div>

> [@Mayus](#):
>
> Because my server doesn’t support PostgreSQL I decided to host the Database on an external free webserver.

You almost certainly don’t want to do that.

You should search here for the subfolder instructions. The [standard install](https://meta.discourse.org/t/142537?silent=true) will have postgres in the container.

---

<div class="post-metadata">

### Author: ![Mayus](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@Mayus](https://meta.discourse.org/u/Mayus)
#### Post date: [October 29, 2018, 11:53am UTC](https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710/4 "2018-10-29T11:53:28Z")

</div>

Thanks for your answers. Yes, I do have root and ssh access.

It’s not that it doesn’t support postgresql its more that we don’t want another database because we already have mysql. Does postgresql need much performance?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 29, 2018, 12:02pm UTC](https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710/5 "2018-10-29T12:02:01Z")

</div>

Postgres 9.6 is required. If you follow the unfussy instructions it will be installed inside the docker container with discourse, redis, and nginx.

---

<div class="post-metadata">

### Author: ![Mayus](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@Mayus](https://meta.discourse.org/u/Mayus)
#### Post date: [October 29, 2018, 12:11pm UTC](https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710/6 "2018-10-29T12:11:47Z")

</div>

How would my nginx config look like? (The existing one)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [October 29, 2018, 12:15pm UTC](https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710/7 "2018-10-29T12:15:57Z")

</div>

You would search for the #howto document and follow these instructions: [Serve Discourse from a subfolder (path prefix) instead of a subdomain](https://meta.discourse.org/t/subfolder-support-with-docker/30507)

---

<div class="post-metadata">

### Author: ![Mayus](https://avatars.discourse-cdn.com/v4/letter/m/ce73a5/32.png) [@Mayus](https://meta.discourse.org/u/Mayus)
#### Post date: [October 29, 2018, 12:21pm UTC](https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710/8 "2018-10-29T12:21:50Z")

</div>

So I would install it with the standard instructions and then modify the configs?

---

<div class="post-metadata">

### Author: ![rbrlortie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rbrlortie/32/166740_2.png) [@rbrlortie](https://meta.discourse.org/u/rbrlortie)
#### Post date: [October 29, 2018, 2:24pm UTC](https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710/9 "2018-10-29T14:24:27Z")

</div>

We are using discourse as a subdirectory. It works but had taken a lot of trial and error by our hosting expert.

I do not know the details. I know that he added reverse proxies and proxy passes to our nginx but that’s all I can say. We followed to documentation that [pfaffman](https://meta.discourse.org/u/pfaffman) linked but even then, depending on your stack there’s a lot of customization to do.

I would not recommend unless you have resources to invest into it.

See: [https://www.robotshop.com/community/forum/](https://www.robotshop.com/community/forum/)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [November 28, 2018, 2:24pm UTC](https://meta.discourse.org/t/install-discourse-as-a-subdirectory-with-existing-nginx/100710/10 "2018-11-28T14:24:27Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
