Post-install issues

I just tried to pop a Mastodon instance and the download, build, and config all turned out without error, however for some reason all of the styling was missing on the login page and once I logged in it became a white page. Upon investigating in the console, I discovered that I had dozens of 404 errors stacked up. I did confirm that everything in /home/mastodon/live/public/packs was there, but when you try to access anything in the folder it just dies with a 404.

Can you tell us something about your webserver configuration?

I followed the official install guide to install it, however I did have to adapt it to Fedora. The majority was done to the letter, but I did have to “translate” packages. I also skipped the IPTables config in favor of FirewallD. I also followed the instructions to setup a separate web domain.

Linux srv1.octal.ventures 5.2.16-200.fc30.x86_64+debug #1 SMP Thu Sep 19 15:44:31 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

This is part of my main domain config:

location /.well-known/host-meta {
            return 301 https://social.w0lfr.net$request_uri;
}

I’m running Nginx 1.16.1 and PHP 7.3.9 under Fedora 30 x86_64.
My Postgresql and Redis servers are running remotely from the Mastodon instance on a second Fedora server. It is running Postgresql 11.5 and Redis 5.0.5.

FirewallD rules on Mastodon server:

public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0 eth1
  sources: 
  services: REMOVED dhcpv6-client http https mdns ssh
  ports: REMOVED
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules:

FirewallD rules on database server:

public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0 eth1
  sources: 
  services: dhcpv6-client mdns mysql postgresql redis ssh
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules:

If you need any other info, just let me know.

The firewall is probably irrelevant. Follow Installation - Mastodon documentation since there is a configuration file that needs to be applied in nginx.

I did follow that guide to install it, including the Nginx config part. That’s the link I put at the top of my previous post.

Sorry, I don’t know what is wrong there then. You need to double check your nginx configuration, especially paths to files and check if the files are really there

/etc/nginx/sites.d/solinwolf/social.w0lfr.net.conf:

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

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

server {
  listen 80;
  listen [::]:80;
  server_name social.w0lfr.net;
  root /home/mastodon/live/public;
  location /.well-known/acme-challenge/ { allow all; }
  location / { return 301 https://$host$request_uri; }
}

server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  server_name social.w0lfr.net;

  ssl_protocols TLSv1.2;
  ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
  ssl_prefer_server_ciphers on;
  ssl_session_cache shared:SSL:10m;

  # Uncomment these lines once you acquire a certificate:
  ssl_certificate     /etc/letsencrypt/live/w0lfr.net/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/w0lfr.net/privkey.pem;

  keepalive_timeout    70;
  sendfile             on;
  client_max_body_size 80m;

  root /home/mastodon/live/public;

  gzip on;
  gzip_disable "msie6";
  gzip_vary on;
  gzip_proxied any;
  gzip_comp_level 6;
  gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

  add_header Strict-Transport-Security "max-age=31536000";

  location / {
    try_files $uri @proxy;
  }

  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 https;
    proxy_set_header Proxy "";
    proxy_pass_header Server;

    proxy_pass http://127.0.0.1:3000;
    proxy_buffering on;
    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 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;
}

/etc/nginx/nginx.conf

user				apache apache;
worker_processes		auto;
error_log			/var/log/nginx/error.log;
include				/usr/share/nginx/modules/*.conf;
events {
	worker_connections	4096;
}


http {
	client_max_body_size	100m;
	client_body_timeout	300s;
	types_hash_max_size	4096;
	include			mime.types;
	default_type		application/octet-stream;
	log_format		main	'$remote_addr - $remote_user [$time_local] "$request" '
					'$status $body_bytes_sent "$http_referer" '
					'"$http_user_agent" "$http_x_forwarded_for"';
	access_log		/var/log/nginx/access.log main;
	sendfile		on;
	tcp_nopush		on;
	tcp_nodelay		on;
	keepalive_timeout	65;
	gzip			on;
	include			sites.d/*/*.conf;
}

The directory exists, as seen here:

drwxrwxr-x 8 mastodon apache 4096 Sep 24 00:34 /home/mastodon/live/public

The reason everything is running under apache user & group is I migrated from Apache HTTPd to Nginx and using that user & group made an easier transition.

I FIGURED IT OUT!

It was a permission problem! This fixed it for me:

find /home/mastodon -type d -exec chmod ug=rwx,o-rwx \;
find /home/mastodon -type f -exec chmod ug=rwX,o-rwx \;

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