Using Multiple Websites with Nginx + Discourse


I’ve managed to set up Nginx to use Discourse as its main site… however i’m having trouble adding addition sites with a prefix, for example

I’ve followed multiple tutorials online and all of them cause the site to not be reached? (my Discourse site is still reachable) how could i fix this?

Alternatively is there a way i could host a HTML site within the Discourse files? for example when i’ve tried to do this in the past it just links to my discourse site with a page not found error.


(Felix Freiberger) #2

Follow these instructions to set up an instance of Nginx on the host:

Once this is complete, you can configure this Nginx instance to also serve any other domain you want, either directly or by proxying to another server :slight_smile:


Hey, thats what i used for making Discourse work with it…

I was unsure whether i’d do that again for another address? if i do would i just use virtually the same code and change the filename from “discourse.conf” to “blahblah.conf”?

Thanks for the response!

(Felix Freiberger) #4

What do you want to run on the second domain? If it’s Discourse, you’ll have to install a second instance (or use multisite), and have a second, similar configuration file. If it’s something different, the configuration will be different, of course :wink:


Yeah its something different. Just something i’ve coded myself.

Which is where i’m having problems… i’ve tried multiple guides to try and add a 2nd site using a prefix like “addons.” but it doesn’t work (Site cannot be reached)?

Here’s an example tutorial that i’ve used: How To Add New Site Into Your Nginx-based Ubuntu Server - ServerMom

(Felix Freiberger) #6

What domain are you trying to add?


Currently have Discourse on gidentity .net (had to space the link because of post requirements for new users)

I want to use the custom stuff on either or (dont think the 2nd one is possible because of Discourse)

(Jay Pfaffman) #8

If you followed the guide linked above, you just need to configure another site in the Nginx on the server (nothing to do with Discourse).

Google something like “configuring multiple sites in nginx”.

(Felix Freiberger) #9

What’s currently missing is DNS for You should set up an A record for this domain that points to :slight_smile:


That must be it! Will try that now, thanks.


That fixed the problem.
Little unrelated… but would i have to update my letsencrypt to allow for the prefix?

(Jay Pfaffman) #12

You’ll need to install Let’s Encrypt in the Nginx on the computer (not the Discourse container).

(Felix Freiberger) #13

You can find some hints on how to do that as part of the following tutorial (but you’ll need to skip some unrelated parts):


Thought I had this sorted but apparently not.
Going to the url no longer displays an error however it automatically forwards to gidentity. net (remove space after . - posting requirements) what could be the cause of this?

EDIT - my DNS records =

(Felix Freiberger) #15

Such a redirect probably means that your configuration isn’t appplying and the wrong one is used.

  • Did you link your new file to show up in the sites-enabled-folder?
  • Did you remember to reload Nginx after that? Did that succeed or show an error?

If these steps don’t help, can you post your configuration files here so we can have a look? :slight_smile: (They shouldn’t contain sensitive information, but please double-check.)