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 addons.domain.com

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 domain.com/othersite? when i’ve tried to do this in the past it just links to my discourse site with a page not found error.

Thanks!

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:

3 Likes

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!

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:

1 Like

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

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 addons.gidentity.net or gidentity.net/addons/ (dont think the 2nd one is possible because of Discourse)

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”.

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

3 Likes

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?

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

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):

1 Like

Thought I had this sorted but apparently not.
Going to the url addons.gidentity.net 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 = https://puu.sh/zVErv/93ed69a2ac.png

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.)

2 Likes