# Trouble configuring discourse with reverse proxy

**URL:** <https://meta.discourse.org/t/trouble-configuring-discourse-with-reverse-proxy/239186>\
**Category:** Self-hosting\
**Created:** [September 16, 2022, 8:51am UTC](https://meta.discourse.org/t/trouble-configuring-discourse-with-reverse-proxy/239186 "2022-09-16T08:51:24Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![bloodshot\_pico](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bloodshot_pico/32/151594_2.png) [@bloodshot\_pico](https://meta.discourse.org/u/bloodshot_pico)\
**Post date:** [September 16, 2022, 8:51am UTC](https://meta.discourse.org/t/trouble-configuring-discourse-with-reverse-proxy/239186/1 "2022-09-16T08:51:24Z")

</div>

Installed Wikijs (Docker compose) and Discourse.

Wikijs was working fine, had the reverse proxy working too.  
Started to install Discourse and it was having a hiccup. So I researched and found out it might be something to do with the docker installation when you install Ubuntu for the first time.

So I stopped the Wikijs docker to update. Reinstalled everything from Dockers repo. Started up Wikijs and there wasn’t any errors that I could see.  
Also booted up Discourse this time and it ran through the entire boot sequence. So I try accessing the sites. Nginx is on another server so I haven’t touched the reverse proxies. Guess what? I can’t access them from both the domain names or the localip:port.

I’m completely confused to what it is since they’re both saying they’re running and Wikijs was letting me connect earlier. I was this close. :') Syslog doesn’t say anything about these two either.

Below is some more info.

Reverse proxies:

```plaintext
server {
        listen 80;
        listen [::]:80;

        root /var/www/website.co.uk/html;
        index index.html index.htm index.nginx-debian.html;

        server_name website.co.uk www.website.co.uk;

        location / {
                rewrite ^(/.*)\.html(\?.*)?$ $1$2 permanent;
                rewrite ^/(.*)/$ /$1 permanent;
                try_files $uri/index.html $uri.html $uri/ $uri =404;
        }

        location /css {
                alias /var/www/website.co.uk/html/css;
        }

        location /images {
                alias /var/www/website.co.uk/html/media/images;
        }

        location /videos {
                alias /var/www/website.co.uk/html/media/videos;
        }

        location /music {
                alias /var/www/website.co.uk/html/media/music;
        }

        location /fonts {
                alias /var/www/website.co.uk/html/media/fonts;
        }

        location /scripts {
                alias /var/www/website.co.uk/html/scripts;
        }
}

server {
        listen 80;
        server_name wiki.website.co.uk;

        #ssl_certificate /etc/nginx/cert.crt;
        #ssl_certificate_key /etc/nginx/cert.key;

        #ssl on;
        #ssl_session_cache builtin:1000 shared:SSL:10m;
        #ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        #ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
        #ssl_prefer_server_ciphers on;

        location / {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;

                proxy_pass http://internalip:port;
                proxy_read_timeout 90;

                proxy_redirect http://127.0.0.1 https://internalip:port;
        }
}
server {
        listen 80;
        server_name forums.website.co.uk;

        #ssl_certificate /etc/nginx/cert.crt;
        #ssl_certificate_key /etc/nginx/cert.key;

        #ssl on;
        #ssl_session_cache builtin:1000 shared:SSL:10m;
        #ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        #ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
        #ssl_prefer_server_ciphers on;

        location / {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;

                proxy_pass http://internalip:port2;
                proxy_read_timeout 90;

                proxy_redirect http://127.0.0.1 https://internalip:port2;
        }
}

```

Tunnel is installed on the same machine as Discourse and Wikijs but I doubt that’s the issue since I’ve had it on a while now without hiccups.  
When visiting the forums I’m greeted with Bad gateway. And with the wiki I get a 504 timeout form Nginx.

Any help with this would be mostly appreciated. 🙂  
Thanks, Blood.

---

_[View the full topic](https://meta.discourse.org/t/trouble-configuring-discourse-with-reverse-proxy/239186)._
