Fresh install 404 error on images and about redirect

Hi, I am new to mastodon. I strictly followed the guide to install mastodon. But each time I get stuck on a single point. After the successful installation, when I try to open the home page echai.pk , I am redirected to the about page → echai.pk - Mastodon and it loads with tons of 404 errors for images, css and js. Below is my nginx config. Also the home directory has mastodon user chown down and has executable permissions. Just cannot seem to figure out the cause. Please help if anyone can :). Even the error logs just give 404 errors. A

*Also https://www.echai.pk gives a block host error?

map $http_upgrade $connection_upgrade {
  default upgrade;
  ''      close;
}


upstream backend {
    server 127.0.0.1:3000 fail_timeout=0;
}

upstream streaming {
    server 127.0.0.1:4000 fail_timeout=0;
}

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=CACHE:10m inactive=7d max_size=1g;


server {
    server_name  echai.pk www.echai.pk;

    #access_log  /var/log/nginx/host.access.log  main;

    location / {
	 try_files $uri @proxy; #mastodon custom
         #root   /home/mastodon/echai.pk/mastodon/public;
         #index index.php index.html index.htm;
    }
    
    #ssl_protocols TLSv1.2 TLSv1.3;
    #ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
    #ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/echai.pk/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/echai.pk/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    keepalive_timeout    70;
    sendfile             on;
    client_max_body_size 80m;
    add_header Strict-Transport-Security "max-age=31536000";

    location ~ ^/(emoji|packs|system/accounts/avatars|system/media_attachments/files) {
    add_header Cache-Control "public, max-age=31536000, immutable";
    add_header Strict-Transport-Security "max-age=31536000";
    try_files $uri @proxy;
  }

  location /sw.js {
    add_header Cache-Control "public, max-age=0";
    #add_header Strict-Transport-Security "max-age=31536000";
    try_files $uri @proxy;
  }

  location @proxy {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header Proxy "";
    proxy_pass_header Server;

    proxy_pass http://127.0.0.1:3000;
    proxy_buffering off;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;

    proxy_cache CACHE;
    proxy_cache_valid 200 7d;
    proxy_cache_valid 410 24h;
    proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
    add_header X-Cached $upstream_cache_status;
    add_header Strict-Transport-Security "max-age=31536000";

    tcp_nodelay on;
  }

  location /api/v1/streaming {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header Proxy "";

    proxy_pass http://127.0.0.1:4000;
    proxy_buffering off;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;

    tcp_nodelay on;
  }

  error_page 500 501 502 503 504 /500.html;

}

server {
    if ($host = www.echai.pk) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = echai.pk) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name  echai.pk www.echai.pk;
    return 404; # managed by Certbot
}

server {
	listen 80 default_server;
	listen [::]:80 default_server;
	server_name _;
	return 301 https://$host$request_uri;
}

Below are the permission settings:

[mastodon@echai mastodon]$ ls -ltr
total 1000
-rw-rw-r--.   1 mastodon mastodon    365 Sep 24 12:59 Aptfile
-rw-rw-r--.   1 mastodon mastodon   3220 Sep 24 12:59 CODE_OF_CONDUCT.md
-rw-rw-r--.   1 mastodon mastodon    369 Sep 24 12:59 Capfile
-rw-rw-r--.   1 mastodon mastodon    261 Sep 24 12:59 SECURITY.md
-rw-rw-r--.   1 mastodon mastodon    249 Sep 24 12:59 Rakefile
-rw-rw-r--.   1 mastodon mastodon    234 Sep 24 12:59 Procfile.dev
-rw-rw-r--.   1 mastodon mastodon    452 Sep 24 12:59 Procfile
-rw-rw-r--.   1 mastodon mastodon  34520 Sep 24 12:59 LICENSE
drwxrwxr-x.  16 mastodon mastodon    226 Sep 24 12:59 app
-rw-rw-r--.   1 mastodon mastodon   1356 Sep 24 12:59 babel.config.js
drwxrwxr-x.   2 mastodon mastodon    184 Sep 24 12:59 bin
-rw-rw-r--.   1 mastodon mastodon   6171 Sep 24 12:59 boxfile.yml
-rw-rw-r--.   1 mastodon mastodon    183 Sep 24 12:59 config.ru
-rw-rw-r--.   1 mastodon mastodon    943 Sep 24 12:59 crowdin.yml
-rw-rw-r--.   1 mastodon mastodon    324 Sep 24 12:59 ide-helper.js
drwxrwxr-x.  18 mastodon mastodon   4096 Sep 24 12:59 lib
drwxrwxr-x.   2 mastodon mastodon     85 Sep 24 12:59 nanobox
drwxrwxr-x.   2 mastodon mastodon     19 Sep 24 12:59 log
-rw-rw-r--.   1 mastodon mastodon     81 Sep 24 12:59 priv-config
-rw-rw-r--.   1 mastodon mastodon    162 Sep 24 12:59 postcss.config.js
drwxrwxr-x.  20 mastodon mastodon   4096 Sep 24 12:59 spec
drwxrwxr-x.   2 mastodon mastodon     22 Sep 24 12:59 streaming
-rw-rw-r--.   1 mastodon mastodon  51413 Sep 24 12:59 AUTHORS.md
-rw-rw-r--.   1 mastodon mastodon   3728 Sep 24 12:59 Dockerfile
-rw-rw-r--.   1 mastodon mastodon   2804 Sep 24 12:59 CONTRIBUTING.md
-rw-rw-r--.   1 mastodon mastodon 203971 Sep 24 12:59 CHANGELOG.md
-rw-rw-r--.   1 mastodon mastodon   4966 Sep 24 12:59 README.md
-rw-rw-r--.   1 mastodon mastodon  20153 Sep 24 12:59 Gemfile.lock
-rw-rw-r--.   1 mastodon mastodon   4115 Sep 24 12:59 Gemfile
-rw-rw-r--.   1 mastodon mastodon   4699 Sep 24 12:59 Vagrantfile
-rw-rw-r--.   1 mastodon mastodon   2997 Sep 24 12:59 app.json
drwxrwxr-x.   3 mastodon mastodon    114 Sep 24 12:59 chart
drwxrwxr-x.   6 mastodon mastodon   4096 Sep 24 12:59 config
drwxrwxr-x.   5 mastodon mastodon     87 Sep 24 12:59 db
drwxrwxr-x.   2 mastodon mastodon    118 Sep 24 12:59 dist
-rw-rw-r--.   1 mastodon mastodon   2739 Sep 24 12:59 docker-compose.yml
-rw-rw-r--.   1 mastodon mastodon   6166 Sep 24 12:59 package.json
-rw-rw-r--.   1 mastodon mastodon   3059 Sep 24 12:59 scalingo.json
-rw-rw-r--.   1 mastodon mastodon 521098 Sep 24 12:59 yarn.lock
drwxrwxr-x.   3 mastodon mastodon     33 Sep 24 13:10 vendor
drwxrwxr-x.   3 mastodon mastodon     22 Sep 24 14:34 build
drwxrwxr-x. 730 mastodon mastodon  32768 Sep 24 14:35 node_modules
drwxrwxr-x.   4 mastodon mastodon     51 Sep 24 15:13 tmp
drwxrwxr-x.  10 mastodon mastodon   4096 Sep 24 23:18 public
[mastodon@echai mastodon]$ pwd
/home/mastodon/echai.pk/mastodon

was able to trouble shoot it. Came down to nginx configuration :slight_smile: . Had to update ’ proxy_buffering off;’ to ’ proxy_buffering on;

and added the below to the main ssl server block

root   /home/mastodon/echai.pk/mastodon/public;

I was able to run everything smoothly on CentOS 8 with custom configuration to mastodon and using latest nginx and redis.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.