# 404-Fehler (Assets) bei Installation im Unterordner

**URL:** https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910
**Category:** Support
**Created:** [20. Juni 2019 um 13:50 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910 "2019-06-20T13:50:14Z")
**Posts on this page:** 20
**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: [20. Juni 2019 um 13:50 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/1 "2019-06-20T13:50:14Z")

</div>

Es ist genau ein Monat her, seit Discourse mir nach einem `git pull` und anschließendem `rebuild` am 15. Mai 404-Fehler bei Asset-Dateien (CSS/JS usw.) zurückgegeben hat. Damals wurde ich über die Seite für automatische Updates aufgefordert, ein Upgrade über die Kommandozeile durchzuführen.

Heute, nach mehreren Tagen, habe ich erneut versucht, neu zu installieren, aber das Problem besteht weiterhin, obwohl es bereits Tage her ist. Der Inhalt meiner `app.yml`-Datei ist unten aufgeführt.

```
##
## Nach Änderungen an dieser Datei MÜSSEN Sie neu erstellen (rebuild), damit
## Änderungen in Ihrer live Discourse-Instanz wirksam werden:
##
## /var/discourse/launcher rebuild app
##
## Stellen Sie sicher, dass Sie die YAML-Syntax einhalten! Sie können diese Seite zur Überprüfung nutzen:
## http://www.yamllint.com/

## Dies ist die All-in-One, eigenständige Discourse Docker-Container-Vorlage

# Sie können eine Ratenbegrenzung aktivieren, indem Sie die Vorlage web.ratelimited auskommentieren.
# Standardmäßig sind 12 Anfragen pro Sekunde und 100 pro Minute pro IP erlaubt.
# Dies kann durch Ändern der Parameter in dieser Datei konfiguriert werden.

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"

expose:
  - "25654:80"
# - "80:80"
# - "2222:22"

params:
  db_default_text_search_config: "pg_catalog.english"
  version: tests-passed

env:
  LANG: en_US.UTF-8
  # DISCOURSE_DEFAULT_LOCALE: en
  UNICORN_WORKERS: 2
  DISCOURSE_DEVELOPER_EMAILS: ''
  DISCOURSE_HOSTNAME: ''
  DISCOURSE_RELATIVE_URL_ROOT: /community

  ## TODO: Der Mailserver, den diese Discourse-Instanz verwenden wird
  DISCOURSE_SMTP_ADDRESS:
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: 
  DISCOURSE_SMTP_PASSWORD: 
  DISCOURSE_SMTP_ENABLE_START_TLS: true
  DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none
  DISCOURSE_SMTP_AUTHENTICATION: login

  ## Die CDN-Adresse für diese Discourse-Instanz (konfiguriert zum Abrufen)
  #DISCOURSE_CDN_URL: //discourse-cdn.example.com

## Diese Container sind zustandslos; alle Daten werden in /shared gespeichert
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

## Das docker_manager-Plugin ermöglicht Ihnen ein Upgrade von Discourse mit einem Klick
## http://discourse.example.com/admin/docker
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
# - git clone https://github.com/discourse/discourse-chat-integration.git
# - git clone https://github.com/gdpelican/babble.git
# - git clone https://github.com/discourse/discourse-solved.git
# - git clone https://github.com/discourse/discourse-adplugin.git
# - git clone https://github.com/communiteq/discourse-sitemap.git
# - git clone https://github.com/discourse/discourse-bbcode-color.git

## Denken Sie daran: Dies ist YAML-Syntax – Sie können nur einen Block mit einem Namen haben
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
    - 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

    - exec: echo "Ende der benutzerdefinierten Befehle" 

```

Im Browser:

 ![17%20PM](https://global.discourse-cdn.com/meta/original/3X/c/8/c86fb75ca41c929221b6659549cf8ef32a59bc47.png)

Ich habe alle Plugins in der YML-Konfiguration deaktiviert, aber es treten weiterhin 404-Fehler bei den Assets auf. Im App-Container ist der Ordner “community” bereits erstellt.

Irgendwelche Vorschläge?

---

<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: [22. Juni 2019 um 08:42 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/2 "2019-06-22T08:42:08Z")

</div>

I made the below changes to the config but did not help.

```
run:
    - exec:
        cd: $home
        cmd:
          - 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 ^/(.*)$ /forum/$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_your_original_ip_header
         global: true

```

---

<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: [26. Juni 2019 um 03:51 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/3 "2019-06-26T03:51:37Z")

</div>

update:

there are 2 folders in /public/community i.e. “backup” and “uploads”. I tried changing the version from `tests-passed` to `stable` again but the issue remains the same i.e. no javascript or CSS files and giving 404 error… I also tried to change the permission for the “uploads” folder in `community` and symlinked `assets` folder in `community` but did not help.

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [26. Juni 2019 um 04:50 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/4 "2019-06-26T04:50:11Z")

</div>

Downgrading isn’t possible, if you’re on tests-passed you can’t rebuild on a lower version (beta/stable).

You would need to stay on the current tests-passed release until Stable or Beta catches up.

Subfolder installs are considered an advanced topic and we really can’t support them here because of all the problems which arise. There are [pages and pages of topics](https://meta.discourse.org/search?q=subfolder) detailing the types of problems found when installing against a subfolder. In 2019 there’s really no good reason to use a subfolder install, all of the SEO claims have been debunked, and the added complexity really adds nothing of value.

Even on CDCK hosting, subfolder installs are only available to enterprise customers, with an additional fee.

I would suggest reverting to a subdomain, or opening a topic on #Marketplace to engage with a consultant.

---

<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: [26. Juni 2019 um 12:29 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/5 "2019-06-26T12:29:56Z")

</div>

I destroyed the container and then rebuild it with the stable release, the problem is with the assets i.e. CSS or javascript files which are not being found. This error happened probably in the update of May. Is there a way I install the previous versions?

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [26. Juni 2019 um 12:58 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/6 "2019-06-26T12:58:13Z")

</div>

Destroying the container doesn’t help, your database was migrated, and as I’ve already said above there’s no way to migrate back. If you didn’t take a backup prior to upgrade you’re stuck at tests-passed until beta or stable reaches the same level.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [26. Juni 2019 um 13:42 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/7 "2019-06-26T13:42:24Z")

</div>

If you have a backup from then you might be able to do a new build and put the Verdun you want in the version line.

You might try entering the container and doing a

```
 rake assets:precompile

```

My current subfolder solution is with traefik as the reverse proxy. I offer that installation as a service if you’re interested.

---

<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: [27. Juni 2019 um 18:19 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/8 "2019-06-27T18:19:28Z")

</div>

Derzeit versuche ich zunächst eine Neuinstallation, wie Sie im ersten Beitrag sehen können, funktioniert sogar die Registrierungsseite nicht richtig. Ich habe `assets:precompile` versucht, aber es hat keine Wirkung gezeigt. Gibt es eine Möglichkeit, eine ältere Version von Discourse Docker zu installieren?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [27. Juni 2019 um 18:33 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/9 "2019-06-27T18:33:24Z")

</div>

> [@john3](#):
>
> Gibt es eine Möglichkeit, eine ältere Version von Discourse Docker zu installieren?

Es sei denn, du möchtest dieses Forum nur ein oder zwei Wochen lang nutzen und es dann löschen, solltest du das wirklich, wirklich, wirklich nicht tun.

Ich vermute, du hast irgendwo einen winzigen Schritt übersehen, der das Problem verursacht, wahrscheinlich in der externen Nginx-Konfiguration. Du solltest das mit der neuesten Version herausfinden.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [27. Juni 2019 um 18:43 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/10 "2019-06-27T18:43:24Z")

</div>

> [@john3](#):
>
> Derzeit versuche ich zunächst eine frische Installation,

Funktioniert eine vollständige Neuinstallation gemäß [Serve Discourse from a subfolder (path prefix) instead of a subdomain](https://meta.discourse.org/t/subfolder-support-with-docker/30507?u=falco) nicht?

---

<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: [27. Juni 2019 um 20:35 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/11 "2019-06-27T20:35:07Z")

</div>

Ja, es funktioniert nicht, deshalb bleibe ich bei 404-Fehlern hängen. JavaScript-Dateien werden nicht geladen und führen zu 404-Fehlern, wie im ersten Beitrag gezeigt.

---

<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: [27. Juni 2019 um 20:36 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/12 "2019-06-27T20:36:57Z")

</div>

Dies ist meine externe Konfiguration für den Nginx-Reverse-Proxy.

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

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [27. Juni 2019 um 21:07 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/13 "2019-06-27T21:07:20Z")

</div>

Aber die YAML-Datei, die du oben hast, sieht nicht wie die auf [Serve Discourse from a subfolder (path prefix) instead of a subdomain](https://meta.discourse.org/t/subfolder-support-with-docker/30507) aus.

---

<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: [27. Juni 2019 um 21:20 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/14 "2019-06-27T21:20:26Z")

</div>

Das liegt daran, dass die Konfigurationsdatei in der Vergangenheit nicht funktioniert hat. Die Datei, die ich derzeit verwende, wurde von @neil [hier](https://meta.discourse.org/t/blank-page-after-installing-discourse-on-subfolder/96112/5) vorgeschlagen und hat früher funktioniert. Ich habe auch versucht, die dort hochgeladene Konfigurationsdatei zu verwenden, aber auch diese hat nicht funktioniert.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [27. Juni 2019 um 21:46 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/15 "2019-06-27T21:46:46Z")

</div>

> [@john3](#):
>
> Ja, es funktioniert nicht. Deshalb stecke ich bei 404-Fehlern fest. JavaScript-Dateien werden nicht geladen und werfen einen 404-Fehler, wie im ersten Beitrag gezeigt.

Nun, ich habe gerade eine brandneue Droplet gekauft und hier eingerichtet: [https://subfolder.muito.ninja/forum](https://subfolder.muito.ninja/forum), gemäß [Serve Discourse from a subfolder (path prefix) instead of a subdomain](https://meta.discourse.org/t/subfolder-support-with-docker/30507)

Bei mir funktioniert es einwandfrei.

Ich befürchte also, dass dein Reverse-Proxy es stört…

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [27. Juni 2019 um 21:46 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/16 "2019-06-27T21:46:48Z")

</div>

Hallo @john3, die Installation in einem Unterordner ist schmerzhaft 😀

Ich habe meine Konfiguration (links) mit deiner (rechts) verglichen. Schau dir bitte Zeile 12 an; wahrscheinlich hast du das Wort `forum` nicht geändert. Außerdem habe ich einen zusätzlichen Block `replace` in den Zeilen 22–29:

 ![%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5](https://global.discourse-cdn.com/meta/original/3X/f/a/fa07426dd3b4941a41402cfc52cd98d5402354fc.png)

Das Ende:

 ![%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5](https://global.discourse-cdn.com/meta/original/3X/6/8/68bdbdac49b070ce885fe9c2032cac010651f4f0.png)

Externer Proxy:

```plaintext
location /discuss {

## Dies ist ProxyPassReverse für Nginx
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $remote_addr;

proxy_set_header X-Forwarded-Proto $scheme;

proxy_read_timeout 3600;
proxy_connect_timeout 240;
proxy_set_header Host $host;
proxy_set_header X-RealIP $remote_addr; #Wichtige Zeile für unser Logging-Ziel

## Ende: Dies ist ProxyPassReverse für Nginx

proxy_pass http://192.168.1.2$request_uri;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

```

---

<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: [28. Juni 2019 um 19:36 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/17 "2019-06-28T19:36:00Z")

</div>

Könntest du mir bitte deine Reverse-Proxy-Konfiguration mitteilen?

---

<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: [28. Juni 2019 um 19:49 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/18 "2019-06-28T19:49:20Z")

</div>

Ich habe die Änderungen vorgenommen, aber es ist immer noch dasselbe. Meine Konfigurationen sind unten aufgeführt. Ich verwende CentOS 7 mit dem Device-Storage-Treiber overlay2.

Nginx-Reverse-Proxy:

```
location /community {
                pagespeed off;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $remote_addr;

proxy_set_header X-Forwarded-Proto $scheme;

proxy_read_timeout 3600;
proxy_connect_timeout 240;
proxy_set_header Host $host;
proxy_set_header X-RealIP $remote_addr; #Wichtige Zeile für unser Logging-Ziel

## Ende: Dies ist ProxyPassReverse für Nginx

proxy_pass http://127.0.0.1:25654$request_uri;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

```

app.yml

```
run:
    - exec:
        cd: $home
        cmd:
          - 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;
          }
    - 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

    - exec: echo "Ende der benutzerdefinierten Befehle"

```

Könnten Sie mir bitte den letzten Teil Ihrer YML-Konfiguration senden, also -exec…?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [28. Juni 2019 um 19:49 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/19 "2019-06-28T19:49:40Z")

</div>

Das hängt davon ab, welche Software Sie für den Reverse-Proxy verwenden.

Ich verwende Caddy und folge [Use Caddy instead of NGINX as your reverse proxy](https://meta.discourse.org/t/running-discourse-with-caddy-server/54716?u=falco)

Die einzige Abweichung vom Leitfaden ist das Hinzufügen des Ordners in der Caddyfile:

```plaintext
subfolder.muito.ninja

proxy /forum unix:/sock/nginx.http.sock {
  transparent
}

```

---

<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: [28. Juni 2019 um 20:00 UTC](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910/20 "2019-06-28T20:00:03Z")

</div>

Ich verstehe… Ich verwende einen Digital Ocean Droplet mit CentOS 7 und dem overlay2 Storage-Treiber. Als Webserver nutze ich Nginx und die SSL-Zertifikate von Let’s Encrypt.

[Nächste Seite](https://meta.discourse.org/t/404-errors-assets-on-subfolder-installation/120910.md?page=2)
