Discourse partially loaded and 404 errors from some css, js, svg files

Hello Discourse forum members.

I install the Discourse successfully before using this link, but in this time, I got the following error, so I need your help for installation.

When I solve this problem, I would like to share how can I fix it.

From Web browser, I got the following error when I install 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)

My environment - Ubuntu 18.94, Nginx Reverse proxy.

I install all the process using root, so Here is “ls -al” information of /var/discourse/shared/standalone

I guess it is permission related problem, but I am not sure.

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

My /nginx/sites-available/forum.sangean.co.kr configuration

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;
}

}

If you need included nginx conf files or Discourse configuration files, I can edit or reply for this post.

Thank you so much.

Your nginx configuration doesn’t look right. Can you share your yml as well?

I guess that you’re trying to run discourse on port 25654 whereas you can easily use the discourse sockets template to run it on a socket and use the proxy to forward requests to the socket.

You can understand the nginx configuration better with this guide: Adding an offline page when rebuilding

@itsbhanusharma Thank you very much for your reply

I will read and implement your post as well by myself.

Here is my app.yml file.

## this is the all-in-one, standalone Discourse Docker container template
##
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  #- "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
  #- "templates/web.ssl.template.yml"
  #- "templates/web.letsencrypt.ssl.template.yml"

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
  - "25654:80"
  #- "80:80"   # http
  #- "443:443" # https

params:
  db_default_text_search_config: "pg_catalog.english"

## Set db_shared_buffers to a max of 25% of the total memory.
  ## will be set automatically by bootstrap based on detected RAM, or you can override
  db_shared_buffers: "256MB"

  ## can improve sorting performance, but adds memory usage per-connection
  #db_work_mem: "40MB"

  ## Which Git revision should this container use? (default: tests-passed)
  #version: tests-passed

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: 3

  ## TODO: The domain name this Discourse instance will respond to
  ## Required. Discourse will not work with a bare IP number.
  DISCOURSE_HOSTNAME: 'forum.sangean.co.kr'

  ## 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

  ## TODO: List of comma delimited emails that will be made admin and developer
  ## on initial signup example 'user1@example.com,user2@example.com'
  DISCOURSE_DEVELOPER_EMAILS: 'admin@sangean.co.kr'

  ## TODO: The SMTP mail server used to validate new accounts and send notifications
  # SMTP ADDRESS, username, and password are required
  # WARNING the char '#' in SMTP password can cause problems!
  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           # (optional, default true)

  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
  #LETSENCRYPT_ACCOUNT_EMAIL: me@example.com

  ## The http or https CDN address for this Discourse instance (configured to pull)
  ## see https://meta.discourse.org/t/14857 for details
  #DISCOURSE_CDN_URL: https://discourse-cdn.example.com

## The Docker container is stateless; all data is stored in /shared
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git

## Any custom commands to run after building
run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  - exec: rails r "SiteSetting.notification_email='admin@sangean.co.kr'"
  - exec: echo "End of custom commands"

Only thing I can suggest here is to implement the post I suggested … That way, You won’t have trouble with reverse proxy.

1 Like