Installed discourse on a server that already runs a webserver, domain just redirects to subdomain

I just set up discourse and then followed this guide.
My subdomain for the forum is

However, when I go to, I just get redirected to

Here is my Namecheap DNS setting:

This is my outer nginx config:

wordpress.conf (my main site):

server {
  listen 80;
  #listen 443 default ssl;

  root /var/www/html;

  #ssl_certificate /etc/nginx/ssl/mydomain.crt;
  #ssl_certificate_key /etc/nginx/ssl/mydomain.key;

  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log error;

  index index.php index.phtml index.html;

  location / {
        try_files $uri $uri/ /index.php?$args;
        if (-f /var/ErrorPages/maintenance.html) {
            return 400;
        # add one directive for each http status code
        error_page 400 /ErrorPages/maintenance.html;
        error_page 404 /ErrorPages/404.html;
        error_page 503 /ErrorPages/503.html;

    # redirect the virtual ErrorPages path the real path
    location /ErrorPages/ {
        alias /var/ErrorPages/;

#  location ~ \.php$ {
#    fastcgi_pass;
 #   fastcgi_split_path_info ^(.+\.php)(/.+)$;
  #  fastcgi_intercept_errors on;
  #  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 #   include /etc/nginx/fastcgi_params;
#  }

    location ~ [^/]\.php(/|$) {
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_intercept_errors on;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include /etc/nginx/fastcgi_params;



discourse.conf (Config for the forum):

server {
    listen 80; listen [::]:80;
    server_name;  # <-- change this

    return 301 https://$host$request_uri;

server {
    listen 443 ssl http2;  listen [::]:443 ssl http2;
    server_name;  # <-- change this

    ssl on;
    ssl_certificate      /var/discourse/shared/standalone/ssl/;
    ssl_certificate_key  /var/discourse/shared/standalone/ssl/;
    ssl_dhparam          /var/discourse/shared/standalone/ssl/dhparams.pem;
    ssl_session_tickets off;

    http2_idle_timeout 5m; # up from 3m default

    location / {
        proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Real-IP $remote_addr;

Thanks a bunch in advance! Any help is highly appreciated!

What I can guess is that there is something wrong with your wordpress configuration (It looks very customized with those error pages etc.)

while trying to access your wordpress, I get

The page isn’t redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

This problem can sometimes be caused by disabling or refusing to accept cookies

Page location is

This is what I get when I try to curl that link:

curl -I
HTTP/1.1 301 Moved Permanently
Server: nginx/1.15.8
Date: Sun, 27 Jan 2019 15:22:11 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Set-Cookie: pll_language=en; expires=Mon, 27-Jan-2020 15:22:11 GMT; Max-Age=31536000; path=/

forum loads fine.

Any chance your primary site is running without ssl as well?

Yes, my wordpress site is running without SSL.
My website is bi-lingual (German & English) and detects your browser’s language. The german wordpress site works fine after clearing the cache.
Just the english page doesn’t work what is kind of weird. Do you know what is the issue?

When we’re at it, how would that SSL transition work?

This is the redirection loop that your site is stuck in.

1 Like

Ok, this is weird.

I just bought the domain and previously we had this domain:

I changed the domain in wp-config and used a plugin.

Which Plugin? can you try disabling it for diagnostics?

It’s called ‘DB Migrate’

So I guess the old domain still remains in certain parts of the DB

My multi-Language plugin is called ‘PolyLang’

I can’t help you much with wordpress here,
You can maybe try disabling all the plugins in wordpress (by moving them out of the /wp-contents/plugin folder) and then trying to see if it fixes it? or maybe hire someone to fix your wordpress.

1 Like

Nevermind, I just had to change the polylang settings :smiley:
Thank you very much for your help!

1 Like

Glad to hear your issue is fixed :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.