# صفحة فارغة بعد تثبيت Discourse في مجلد فرعي

**URL:** https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112
**Category:** Self-hosting
**Created:** [31 أغسطس 2018، 7:18م UTC](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112 "2018-08-31T19:18:05Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![john3](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@john3](https://meta.discourse.org/u/john3)
#### Post date: [31 أغسطس 2018، 7:18م UTC](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112/1 "2018-08-31T19:18:05Z")

</div>

Hey!

I am trying to setup discourse on a subfolder. Followed the [how-to](https://meta.discourse.org/t/subfolder-support-with-docker/30507) but I get a blank page with 404 on all resources.

I entered the container `app` and tried the following command but get an error:

```
root@discourse:/var/www/discourse# RAILS_ENV=production bundle exec script/discourse remap '/uploads' '/community/uploads'
bundler: failed to load command: script/discourse (script/discourse)
PG::ConnectionBad: FATAL: Peer authentication failed for user "discourse"

```

Also my server’s nginx conf:

```
 location /community/ {
# rewrite /(.*) /$1 break;
                proxy_pass http://meta.domain.org:25654/;
                proxy_read_timeout 90;
                proxy_redirect http://meta.domain.org:25654/ https://meta.domain.org/;
                proxy_set_header Host $http_host;
                proxy_http_version 1.1;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

```

YAML Config:

```
  - exec:
      cd: $home
      cmd:
        - mkdir -p public/community
        - cd public/community && ln -s ../uploads && ln -s ../backups
        - rm public/uploads
        - rm public/backups
  - replace:
     global: true
     filename: /etc/nginx/conf.d/discourse.conf
     from: proxy_pass http://discourse;
     to: |
        rewrite ^/(.*)$ /community/$1 break;
        proxy_pass http://discourse;
  - replace:
     filename: /etc/nginx/conf.d/discourse.conf
     from: etag off;
     to: |
        etag off;
        location /community {
           rewrite ^/community/?(.*)$ /$1;
        }
  - replace:
     filename: /etc/nginx/conf.d/discourse.conf
     from: $proxy_add_x_forwarded_for
     to: $http_fastly_client_ip
     global: true

```

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [31 أغسطس 2018، 8:14م UTC](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112/2 "2018-08-31T20:14:17Z")

</div>

> [@john3](#):
>
> PG::ConnectionBad: FATAL: Peer authentication failed for user “discourse”

That’s the problem you need to look at first. Did the site work without subfolder?

---

<div class="post-metadata">

### Author: ![john3](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@john3](https://meta.discourse.org/u/john3)
#### Post date: [31 أغسطس 2018، 8:21م UTC](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112/3 "2018-08-31T20:21:47Z")

</div>

@neil Yes, the site was working fine on the subdomain. But, after bootstrapping its unable to find resources i.e. it’s looking for assets/stylesheets and other resources in `sub.domain.org/*` instead of `sub.domain.org/community`. but, `uploads` files are fine with path `sub.domain.org/community/uploads/`.

Is it because of the previous database? as that was on the subdomain.

Also, I am not sure if `community` should exist in the `public` as in logs it shows:

```
I, [2018-08-31T20:27:08.692777 #14] INFO -- : > cd /var/www/discourse && mkdir -p public/community
I, [2018-08-31T20:27:08.696953 #14] INFO -- :
I, [2018-08-31T20:27:08.697067 #14] INFO -- : > cd /var/www/discourse && cd public/community && ln -s ../uploads && ln -s ../backups 
....

```

but then in the container:

```
[root@server discourse]# sudo ./launcher enter app
which: no docker.io in (/sbin:/bin:/usr/sbin:/usr/bin)
root@discourse:/var/www/discourse# cd public/community
bash: cd: public/community: No such file or directory

```

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [31 أغسطس 2018، 8:48م UTC](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112/4 "2018-08-31T20:48:11Z")

</div>

The database should not have changed just because you added configuration for subfolder. Also, even though you can see that public/community is being created, it doesn’t exist. This is very confusing. I can’t tell what’s wrong with your setup so I don’t know how to help.

---

<div class="post-metadata">

### Author: ![john3](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@john3](https://meta.discourse.org/u/john3)
#### Post date: [31 أغسطس 2018، 8:56م UTC](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112/5 "2018-08-31T20:56:27Z")

</div>

Hmm but `uploads` folder is working fine, the images that I uploaded previously exist in the subfolder.

It’s something like below:

This is fine.  
`<link rel="icon" type="image/png" href="/community/uploads/default/original/1X/87da3cc4e563ce7b15dc0b01e79d04714.ico">`

This is wrong. Should have been `/community/assets...`

`<script src='/assets/locales/en-ef130f04fe2d3ddf9d0b85d2da12e75a5b16387aa046890bcaf41c2a.js'></script>`  
`<link href="/stylesheets/desktop_theme_3_6a8144912cf399034c2b503bd01fc6bcdd.css?__ws=meta.domain.org" media="all" rel="stylesheet" data-target="desktop_theme"/>`

This should have been `/community/t....`.

```
  <a href='/t/welcome-to-community-read-first/8' itemprop='item'>

```

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [31 أغسطس 2018، 8:59م UTC](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112/6 "2018-08-31T20:59:23Z")

</div>

Here’s some other yml I’ve used. Yours is missing the assets precompile:

```yml
  - exec:
      cd: $home
      cmd:
        - rm -fr public/assets
        - sudo -E -u discourse bundle exec rake assets:precompile
        - mkdir -p public/community
        - cd public/community && ln -s ../uploads && ln -s ../backups
  - replace:
     global: true
     filename: /etc/nginx/conf.d/discourse.conf
     from: proxy_pass http://discourse;
     to: |
        rewrite ^/(.*)$ /community/$1 break;
        proxy_pass http://discourse;
  - replace:
     filename: /etc/nginx/conf.d/discourse.conf
     from: etag off;
     to: |
        etag off;
        location /community {
           rewrite ^/community/?(.*)$ /$1;
        }

```

---

<div class="post-metadata">

### Author: ![john3](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@john3](https://meta.discourse.org/u/john3)
#### Post date: [31 أغسطس 2018، 9:30م UTC](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112/7 "2018-08-31T21:30:48Z")

</div>

Now my config:

```
run:
    - exec:
        cd: $home
        cmd:
          - rm -fr public/assets
          - sudo -E -u discourse bundle exec rake assets:precompile
          - mkdir -p public/community
          - cd public/community && ln -s ../uploads && ln -s ../backups
          - rm public/uploads
          - rm public/backups
    - replace:               
    .....

```

gives me `/community/community/uploads` rather than `/community/uploads/`. But assets/stylesheets remain the same as before i.e. instead of being located in the `community` folder, the site is searching these files in `sub.domain.org`.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [31 أغسطس 2018، 9:35م UTC](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112/8 "2018-08-31T21:35:40Z")

</div>

I can’t tell what the cause of all your problems (can’t connect to db, multiple /community directories, wrong assets path, etc…) is from this topic. and I’ve never seen those problems from a subfolder config before. I recommend going back to subdomain.

---

<div class="post-metadata">

### Author: ![john3](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@john3](https://meta.discourse.org/u/john3)
#### Post date: [31 أغسطس 2018، 9:57م UTC](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112/9 "2018-08-31T21:57:38Z")

</div>

Strange but it worked by destroying all containers and then rebuilding from scratch.

`sudo ./launcher destroy app`  
`docker rmi .....`  
`sudo ./launcher rebuild app`

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [5 سبتمبر 2018، 10:00م UTC](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112/10 "2018-09-05T22:00:07Z")

</div>

This topic was automatically closed after 44 hours. New replies are no longer allowed.
