# Redirect to discourse from a route in another domain

**URL:** <https://meta.discourse.org/t/redirect-to-discourse-from-a-route-in-another-domain/49059>\
**Category:** Self-hosting\
**Created:** [2016 年8 月 23 日 12:01 UTC](https://meta.discourse.org/t/redirect-to-discourse-from-a-route-in-another-domain/49059 "2016-08-23T12:01:53Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![mangelsnc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mangelsnc/32/60920_2.png) [@mangelsnc](https://meta.discourse.org/u/mangelsnc)\
发布日期： [2016 年8 月 23 日 12:01 UTC](https://meta.discourse.org/t/redirect-to-discourse-from-a-route-in-another-domain/49059/1 "2016-08-23T12:01:53Z")

</div>

Hi!

I need to put the discourse forum under a URL like `https://mydomain.com/forum`.

I have installed NGinx in the server which hosts discourse ([forum.mydomain.com](http://forum.mydomain.com)) , and redirected it to the discourse instance, something similar to this: [https://serversforhackers.com/video/installing-discourse-with-docker](https://serversforhackers.com/video/installing-discourse-with-docker) but without divide it in 3 containers.

In `mydomain.com` server I have the next configuration:

```plaintext
location /forum {
    rewrite ^/forum/(.*) /$1 break;
    proxy_pass https://forum.mydomain.com;
    proxy_redirect off;
    proxy_buffering off;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

```

And the configuration of `forum.mydomain.com` is:

```plaintext
upstream discourse {
    server 127.0.0.1:8080;
}

server {
    listen 80 default_server;
    server_name mydomain.com/forum;
    return 301 https://mydomain.com/forum$request_uri;
}

server {
    listen 443 default_server ssl;

    client_body_buffer_size 32k;
    client_header_buffer_size 8k;
    large_client_header_buffers 8 64k;

    root /var/www/discourse/public;
    index index.html index.htm;

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

    server_name mydomain.com/forum;
    merge_slashes on;

    charset utf-8;

    ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;

    location ~ /.well-known {
       allow all;
    }

    location / {
        include proxy_params;
        proxy_pass http://discourse;

        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

```

When I access to `https://mydomain.com/forum` it redirects me to the forum, but fails loading CSS and shows the next error: `Oops! That page doesn’t exist or is private.`

There’s anyone in the room who has did this and succeed?

I’m open to any tutorial or simplest way to do this.

Thanks!

---

_[View the full topic](https://meta.discourse.org/t/redirect-to-discourse-from-a-route-in-another-domain/49059)._
