# How to make Discourse coexist with nginx on a Debian 9 server?

**URL:** https://meta.discourse.org/t/how-to-make-discourse-coexist-with-nginx-on-a-debian-9-server/155438
**Category:** Self-hosting
**Created:** [June 20, 2020, 3:05pm UTC](https://meta.discourse.org/t/how-to-make-discourse-coexist-with-nginx-on-a-debian-9-server/155438 "2020-06-20T15:05:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![unfa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/unfa/32/184591_2.png) [@unfa](https://meta.discourse.org/u/unfa)
#### Post date: [June 20, 2020, 3:05pm UTC](https://meta.discourse.org/t/how-to-make-discourse-coexist-with-nginx-on-a-debian-9-server/155438/1 "2020-06-20T15:05:37Z")

</div>

Hi!

I’m a noob when it comes to setting up servers, so please forgive my ignorance, I’m trying to learn. I’ve been using Linux for a decade for media production, but setting up web services is a different beast apparently.

I’ve installed Discourse on my server running Debian 9. Later I installed nginx to put a simple website there, which will later provide visitors with a link to a subdomain hosting the Discourse server.

I’ve temporarily renamed `/var/discourse` to `/var/_discourse` and after a reboot nginx works. before it seemed that Discourse has hijacked the server’s http port.

However I’m still wondering how to make the two work together later.  
I’ll probably want to put a main landing page on my domain and put the Discourse on a subdomain there.

I’d be grateful for any help with this.

I guess I could point nginx to a directory with Discourse’s `index.html` and make it expose that on a subdomain, right?

How do I make the two work together?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [June 20, 2020, 3:27pm UTC](https://meta.discourse.org/t/how-to-make-discourse-coexist-with-nginx-on-a-debian-9-server/155438/3 "2020-06-20T15:27:45Z")

</div>

This article shall answer all your questions:

> [@Run other websites on the same machine as Discourse](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247):
>
> @pfaffman edited this heavily 2022.02.24. Blame me if it’s broken. If you want to run other websites on the same machine as Discourse, you need to set up an extra NGINX or HAProxy proxy in front of the Docker container. NOTE: This is for advanced admins This guide assumes you already have Discourse working - if you don’t, it may be hard to tell whether or not the configuration is working. You cannot use ./discourse-setup to set up Discourse if another server is using port 80 or 443. You will…

---

<div class="post-metadata">

### Author: ![unfa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/unfa/32/184591_2.png) [@unfa](https://meta.discourse.org/u/unfa)
#### Post date: [June 20, 2020, 3:31pm UTC](https://meta.discourse.org/t/how-to-make-discourse-coexist-with-nginx-on-a-debian-9-server/155438/4 "2020-06-20T15:31:19Z")

</div>

Thanks!  
I’ve just updated my initial post, I’ll check this link out.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [June 20, 2020, 3:35pm UTC](https://meta.discourse.org/t/how-to-make-discourse-coexist-with-nginx-on-a-debian-9-server/155438/5 "2020-06-20T15:35:56Z")

</div>

Your solution is to actually break Discourse directory structure to prevent it from starting up.

You could simply stop it through  
`./launcher stop app`
