Discourse の一部読み込みと、いくつかの CSS、JS、SVG ファイルからの 404 エラー

Discourse フォーラムの皆さん、こんにちは。

以前は、この リンク を使って Discourse を正常にインストールできましたが、今回は以下のエラーが発生してしまいました。インストールのサポートをお願いします。

この問題を解決したら、どのように修正したか共有したいと考えています。

Web ブラウザから Discourse をインストールしようとすると、以下のエラーが表示されます。

[Error] Failed to load resource: the server responded with a status of 404 () (wizard_c4aee3fa9261fde8baf9c596832d10e16a40c298.css, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (wizard-vendor-e639f7bedb553c62a51539714bacf10a7bb9c2a68ee57d9d9e9da130ede31d8b.js, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (tada.svg, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (ember_jquery-57d09ec67e9e407d9b0d42aa1fefd1a470c45310d953b07793a3ca8adc6ec599.js, line 0)
[Error] Refused to execute https://forum.sangean.co.kr/assets/ember_jquery-57d09ec67e9e407d9b0d42aa1fefd1a470c45310d953b07793a3ca8adc6ec599.js as script because “X-Content-Type: nosniff” was given and its Content-Type is not a script MIME type.
[Error] Refused to execute https://forum.sangean.co.kr/assets/wizard-vendor-e639f7bedb553c62a51539714bacf10a7bb9c2a68ee57d9d9e9da130ede31d8b.js as script because “X-Content-Type: nosniff” was given and its Content-Type is not a script MIME type.
[Error] Failed to load resource: the server responded with a status of 404 () (tada.svg, line 0)

私の環境は Ubuntu 18.94、Nginx リバースプロキシです。

すべての手順を root ユーザーで実行しました。以下は /var/discourse/shared/standalonels -al 情報です。

パーミッション関連の問題だと推測していますが、確信はありません。

drwxr-xr-x 11 root root 4096 Apr 4 05:50 .
drwxr-xr-x 3 root root 4096 Apr 4 04:45 ..
drwxr-xr-x 2 1000 www-data 4096 Apr 4 04:45 backups
drwxr-xr-x 4 root root 4096 Apr 4 04:45 log
drwxr-xr-x 2 uuidd uuidd 4096 Apr 4 04:45 postgres_backup
drwx------ 19 uuidd uuidd 4096 Apr 4 05:50 postgres_data
drwxrwxr-x 3 uuidd uuidd 4096 Apr 4 05:50 postgres_run
drwxr-xr-x 2 landscape ssh 4096 Apr 4 06:00 redis_data
drwxr-xr-x 4 root root 4096 Apr 4 05:50 state
drwxr-xr-x 4 1000 www-data 4096 Apr 4 05:50 tmp
drwxr-xr-x 3 1000 www-data 4096 Apr 4 04:47 uploads

私の /nginx/sites-available/forum.sangean.co.kr 設定は以下の通りです。

server {
listen 80; listen [::]:80;
server_name forum.sangean.co.kr;

return 301 https://$host$request_uri;

}

server {
server_name forum.sangean.co.kr www.forum.sangean.co.kr;

access_log /var/log/nginx/forum.sangean.co.kr.access.log ;
error_log /var/log/nginx/forum.sangean.co.kr.error.log;

include common/locations-wo.conf;
include /var/www/forum.sangean.co.kr/conf/nginx/*.conf;

location / {
    proxy_pass http://forum.sangean.co.kr:25654/;
    proxy_set_header Host $http_host;
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_redirect http://forum.sangean.co.kr:25654/ https://forum.sangean.co.kr;
}

}

必要な場合は、関連する nginx 設定ファイルや Discourse 設定ファイルを含めることもできますので、この投稿を編集するか返信してください。

よろしくお願いいたします。

nginx の設定が正しくないようです。yml ファイルも共有していただけませんか?

おそらくポート 25654 で Discourse を実行しようとしているようですが、Discourse のソケット用テンプレートを使ってソケット上で実行し、プロキシでそのソケットへのリクエストを転送することも簡単に可能です。

このガイドで nginx の設定をより深く理解できます:Add an offline page to display when Discourse is rebuilding or starting up

@itsbhanusharma ご返信ありがとうございます。

私もあなたの投稿を読み、実装いたします。

以下が私の app.yml ファイルです。

## これはオールインワン、スタンドアロンの Discourse Docker コンテナテンプレートです
##
## このファイルに変更を加えた後は、必ず再構築してください
## /var/discourse/launcher rebuild app
##
## 編集時は *非常に* 注意してください!
## YAML ファイルは、空白やアライメントのミスに非常に、非常に敏感です!
## 必要に応じて http://www.yamllint.com/ を訪れてこのファイルを検証してください

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  #- "templates/web.ratelimited.template.yml"
## Lets Encrypt (https) を追加したい場合は、以下の 2 行のコメントを外してください
  #- "templates/web.ssl.template.yml"
  #- "templates/web.letsencrypt.ssl.template.yml"

## このコンテナが公開する TCP/IP ポートはどれですか?
## Discourse を Apache や nginx などの他の Web サーバーとポートを共有したい場合は、
## 詳細については https://meta.discourse.org/t/17247 を参照してください
expose:
  - "25654:80"
  #- "80:80"   # http
  #- "443:443" # https

params:
  db_default_text_search_config: "pg_catalog.english"

## db_shared_buffers を総メモリの最大 25% に設定します。
  ## ブートストラップによって検出された RAM に基づいて自動的に設定されますが、上書きすることもできます
  db_shared_buffers: "256MB"

  ## ソートパフォーマンスを向上させることができますが、接続ごとのメモリ使用量が増加します
  #db_work_mem: "40MB"

  ## このコンテナが使用する Git リビジョンはどれですか?(デフォルト: tests-passed)
  #version: tests-passed

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

  ## 同時 Web リクエストを何件サポートしますか?メモリと CPU コア数に依存します。
  ## ブートストラップによって検出された CPU に基づいて自動的に設定されますが、上書きすることもできます
  UNICORN_WORKERS: 3

  ## TODO: この Discourse インスタンスが応答するドメイン名
  ## 必須です。Discourse は IP アドレス単体では動作しません。
  DISCOURSE_HOSTNAME: 'forum.sangean.co.kr'

  ## 上記で指定したホスト名(-h オプション)と同じホスト名でコンテナを起動したい場合は、コメントを外してください

## (デフォルト: "$hostname-$config")
  #DOCKER_USE_HOSTNAME: true

  ## TODO: 初期サインアップ時に管理者および開発者に指定されるカンマ区切りのメールリスト
  ## 例: 'user1@example.com,user2@example.com'
  DISCOURSE_DEVELOPER_EMAILS: 'admin@sangean.co.kr'

  ## TODO: 新しいアカウントの検証や通知の送信に使用する SMTP メールサーバー
  # SMTP アドレス、ユーザー名、パスワードは必須です
  # 警告: SMTP パスワードに含まれる '#' 文字は問題を引き起こす可能性があります!
  DISCOURSE_SMTP_ADDRESS: smtp.elasticemail.com
  DISCOURSE_SMTP_PORT: 2525
  DISCOURSE_SMTP_USER_NAME: admin@sangean.co.kr
  DISCOURSE_SMTP_PASSWORD: 58BD8932EDB9FEF87F8B3F0A75F482295B4B
  #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (オプション、デフォルト: true)

  ## Lets Encrypt テンプレートを追加した場合は、以下をコメント外して無料の SSL 証明書を取得してください
  #LETSENCRYPT_ACCOUNT_EMAIL: me@example.com

  ## この Discourse インスタンスの http または https CDN アドレス(プルするように設定)
  ## 詳細については https://meta.discourse.org/t/14857 を参照してください
  #DISCOURSE_CDN_URL: https://discourse-cdn.example.com

## Docker コンテナはステートレスです。すべてのデータは /shared に保存されます
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

## プラグインはここに記述します
## 詳細については https://meta.discourse.org/t/19157 を参照してください
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git

## ビルド後に実行する任意のカスタムコマンド
run:
  - exec: echo "Beginning of custom commands"
  ## 最初の登録時の 'From' メールアドレスを設定したい場合は、コメントを外して変更してください
  ## 最初のサインアップメールを受け取った後、再度その行をコメントアウトしてください。一度だけ実行すれば十分です
  - exec: rails r "SiteSetting.notification_email='admin@sangean.co.kr'"
  - exec: echo "End of custom commands"

ここで私が提案できるのは、私が提案したポストを実装することだけです。そうすれば、リバースプロキシで問題に直面することはなくなります。