# Subfolder with SSL and nginx reverse proxy

**URL:** <https://meta.discourse.org/t/subfolder-with-ssl-and-nginx-reverse-proxy/69496>\
**Category:** Self-hosting\
**Created:** [06.Сентябрь.2017 20:04:40 UTC](https://meta.discourse.org/t/subfolder-with-ssl-and-nginx-reverse-proxy/69496 "2017-09-06T20:04:40Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Ironclad14](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ironclad14/32/120185_2.png) [@Ironclad14](https://meta.discourse.org/u/Ironclad14)\
**Post date:** [06.Сентябрь.2017 20:04:41 UTC](https://meta.discourse.org/t/subfolder-with-ssl-and-nginx-reverse-proxy/69496/1 "2017-09-06T20:04:41Z")

</div>

Hey guys,

I looked around but I couldn’t see a guide on how to host Discourse on [domain.com/forum](http://domain.com/forum) with SSL, using nginx as a reverse proxy. Currently, I’m running the forum on a subdomain - [forum.domain.com](http://forum.domain.com) and What I have in mind is, I’ll use nginx to secure the connection between the user and my server, and then call discourse locally unsecured via reverse proxy since they’re on the same machine, as per the latest set up tutorial.

I already have Ghost running the same way, and it works flawlessly.

This is my old location statement for the reverse proxy for [forum.domain.com](http://forum.domain.com) and it worked, though not securely.

```
# 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 $scheme;
# }
}

```

When I set this same proxy pass on location /forum in the main server block, I’m getting 404 errors for all assets, even though they’re being loaded via /forum/

```
location /forum {
        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 $scheme;

```

}

The error console shows these assets are missing:

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/e/7e62393466a1d5bab0a76c68464e7c4c7b799eb9.png)

Strangely enough, the 404 pages almost work consistently, but are still missing image assets:

 ![image](https://global.discourse-cdn.com/meta/original/3X/0/c/0c25a90fa193daa86d7184fae7488af96d002146.png)

What I also notice is that when I do `discourse remap domain.com/ domain.com/forum`, there’s an error remapping theme\_fields

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/b/7b0ec8930f3b1ad1da6333c781333ccf9c3dfdf3.png)

Is there a way I can check these rows specifically and see what the problem is?

The easiest solution would be a wildcard certificate but that’s beyond my budget range at this point.

Any help would be appreciated and I do apologise if this issue was already resolved elsewhere, I just couldn’t find this specific scenario.

Update: Here’s the env variables in app.yml

```
env:
  LANG: en_US.UTF-8
  # DISCOURSE_DEFAULT_LOCALE: en

  ## How many concurrent web requests are supported? Depends on memory and CPU cores.
  ## will be set automatically by bootstrap based on detected CPUs, or you can override
  UNICORN_WORKERS: 8

  ## TODO: The domain name this Discourse instance will respond to
  DISCOURSE_HOSTNAME: legiochristi.com
  DISCOURSE_RELATIVE_URL_ROOT: /forum

  ## Uncomment if you want the container to be started with the same
  ## hostname (-h option) as specified above (default "$hostname-$config")
  DOCKER_USE_HOSTNAME: true

```

---

_[View the full topic](https://meta.discourse.org/t/subfolder-with-ssl-and-nginx-reverse-proxy/69496)._
