Using Multiple Websites with Nginx + Discourse

AI-generated summary

In a discussion titled “Using Multiple Websites with Nginx + Discourse,” user Zarken seeks help adding a secondary site (addons.gidentity.net or gidentity.net/addons/) alongside their existing Discourse installation. They’ve followed guides but encounter “site cannot be reached” errors. fefrei advises setting up a separate Nginx instance on the host and confirms that for a non-Discourse site, a new configuration file (e.g., “blahblah.conf”) is needed. Zarken confirms using the same guide for Discourse and asks if reusing the config structure works — fefrei clarifies it depends on the target site’s nature. Zarken reveals the second site is custom-coded and shares a tutorial they tried. fefrei asks for the domain, leading to the discovery that DNS for addons.gidentity.net was missing — Zarken confirms this was the issue after adding an A record pointing to 185.38.148.133 fefrei. After fixing DNS, Zarken reports the site loads but redirects to the main Discourse domain. fefrei suspects misconfigured Nginx — suggesting checking if the config file is symlinked to sites-enabled and whether Nginx was reloaded successfully. pfaffman adds that Let’s Encrypt must be configured on the host’s Nginx, not the Discourse container, and fefrei provides a tutorial link for SSL setup. The thread ends with Zarken sharing their DNS records and awaiting further troubleshooting.

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:

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:

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:

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

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