Discourse nginx conf


(Gabriel) #1

Hello,

I have installed Discourse following instructions from github repository :

And it’s running well :slight_smile:

The host domain name for this is : forum.mydomain.com but I would like to host it as : mydomain.com/forum instead so it improves my SEO. And I am struggling to do so…

I have some knowledge about nginx and setting things up. But not about docker.
From my researches, i could need a reverse proxy but I didn’t find a case like mine.

Do you have any recommandations or way to do so ?


(Jeff Atwood) #2

Subfolder is a much more complex setup, and we advise against it unless you want to absorb significant additional complexity for essentially no benefit, other than the aesthetics of forum.example.com versus www.example.com/forum


(Gabriel) #3

Adding our forum as a subdomain would significantly improve SEO and this is our main value (being well ranked).

I am ready to go into additional complexity if needed. I did it for our forum (wordpress hosted) and it went well.


(Jeff Atwood) #4

It does not; this was confirmed by Matt Cutts at Google (before he left to work for the US Digital Service). Feel free to search here for specifics.

Subfolder adds massive setup complexity for no benefit – other than aesthetics.


(Gabriel) #5

I read before what Matt Cutts said. Thats why I did a subdomain first.
But then after researching more deeply I might have found that what he said back in 2012 might not be true now.



(Jay Pfaffman) #6

(Christoph) #7

Hm, that SISTRIX article shows some graphs indicating that some websites received more traffic from Google directly after they changed from subdomains to subdirectories. It then tries to explain what exactly might be the cause for this (given that Google says that they don’t prioritize one over the other). And the the two explanations mentioned are:

  1. novelty
  2. some systems do a better job at interlinking between subdirectories than between subdomains

Neither of these mean that subdirectories automatically are better for SEO. The novelty mechanism may work in the sort term, but (by definition) the effect will wear off in the medium and long term. (And, notably, it wont work at all for an entirely new forum.)

Which leaves us with the systems argument and that - I assume, correct me if I’m wrong - doesn’t apply to discourse.

Ergo: SEO is not a reason for diverging from the default subdomain setup of discourse.


(Neil Lalonde) #8

Something we realized recently was this, which I added to the subfolder wiki:

Now that Discourse is running on a subfolder, it cannot serve its robots.txt file to control which routes are crawled by web crawlers. Crawlers will be looking at your main site’s robots.txt file (http://www.example.com/robots.txt). You need to copy the contents of Discourse’s robots.txt file (found at http://www.example.com/forum/robots.txt) and put it in your main site’s robots.txt file.

So you might be seeing more routes being indexed and crawled, which can mess up your numbers and possibly rankings. Be sure to update your main site’s robots.txt file.


(Gabriel) #9

Thanks for your answer @pfaffman. Indeed thats not an easy task, moreover I have already some topics created since we launch it.

@Cristoph I got your point. But it will add valued content to the main website so it does improve SEO.

Subdomain is considered as an other website whereas subdirectory is part of the main website from what I understood from further reading online.


(Jeff Atwood) #10

It does not. We will not help you with this, effectively what you are saying is “I want to cut myself with a :hocho: knife” – if you want to do that, we can’t stop you, but we strongly advise against it because it will hurt (more technically complicated setup, more complex to maintain and troubleshoot over time, zero practical benefit).


(Michael - DiscourseHosting.com) #11

Websites don’t rank in search engines. Pages rank in search engines. They didn’t call it “siterank” for a reason.


(Christoph) #12

Yeah, cause after all, Larry Page isn’t called Larry Site. :star_struck:


(Michael - DiscourseHosting.com) #13

Ok, they didn’t call it siterank for two reasons :wink:


(Kane York) #14

That quote says:

subdomains will be more work [… for publishing-style / Wordpress-style content]

However, that does not hold up for a Discourse forum – subdomains will be less work, so you should use them.


(Gabriel) #15

What I meant is Websites have a “notoriety mark” with google that help their pages to rank and Discourse as a subdomain could help with this.

Nevertheless, who would want to cut himself with a knife :grin: I will go along with with subdomain for now.


(Jeff Atwood) #16

Believe me, if either way was just as easy I would happily tell you to pick whatever you liked. That is not the case!