Missing Stylesheets and 404 Errors – Need Help with Reverse Proxy and Apache Config

Subject: Missing Stylesheets and 404 Errors After Upgrading to PHP 8.3 – Need Help with Reverse Proxy and Apache Config

Hello Nextcloud community,

I’m feeling quite frustrated and would greatly appreciate any help or insight you can offer. I’ve tried everything I can think of, but I’m stuck with my Nextcloud installation after upgrading to PHP 8.3.

My Setup:

  • Data directory: /mnt/nas/nextcloud_data
  • Nextcloud installed at: /var/www/nextcloud
  • Version: Nextcloud 30.0.0.14
  • Server: Nginx reverse proxy with Apache as the backend server
  • MariaDB: Fully reinstalled as part of troubleshooting

The Problem:

After reinstalling and configuring everything, I can log into Nextcloud, but the dashboard is missing all styling, and I’m getting flooded with 404 errors in the browser console, such as:

GET https://cloud.infraviored.lol/index.php/apps/theming/theme/default.css?plain=1&v=52ebc0b5 net::ERR_ABORTED 404 (Not Found)
GET https://cloud.infraviored.lol/index.php/apps/theming/theme/light.css?plain=1&v=52ebc0b5 net::ERR_ABORTED 404 (Not Found)
GET https://cloud.infraviored.lol/index.php/apps/theming/theme/dark.css?plain=0&v=52ebc0b5 net::ERR_ABORTED 404 (Not Found)

The dashboard appears as plain text with no style, and it seems the theming-related CSS files are missing or not being loaded correctly.

What Happened:

Before switching to PHP 8.3, the setup worked perfectly, and I had proper styling. However, I did experience a similar issue when attempting to change the theme prior to the upgrade. Now, after upgrading, the problem shows up immediately, even without trying to modify the theme.

What I’ve Tried So Far:

  • Removed the data directory (/mnt/nas/nextcloud_data)
  • Completely removed and reinstalled Nextcloud
  • Removed and reinstalled MariaDB
  • Rechecked my Nginx and Apache configurations multiple times
  • Purged all caches and session data

I’m convinced that the issue might lie in my reverse proxy setup (Nginx) or in the Apache configuration, but I can’t figure out exactly what is wrong.


Config Files

config.php (Sensitive values removed for security)

<?php
$CONFIG = array (
  'instanceid' => 'oc1...',
  'passwordsalt' => 'removed',
  'secret' => 'removed',
  'trusted_domains' => 
  array (
    0 => 'cloud.infraviored.lol',
    1 => 'localhost',
  ),
  'datadirectory' => '/mnt/nas/nextcloud_data',
  'dbtype' => 'mysql',
  'version' => '30.0.0.14',
  'overwrite.cli.url' => 'https://cloud.infraviored.lol',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbuser' => 'nextclouddbuser',
  'dbpassword' => 'removed',
  'installed' => true,
  'trusted_proxies' => ['127.0.0.1', '::1'],
  'forwarded_for_headers' => ['HTTP_X_FORWARDED_FOR'],
  'htaccess.RewriteBase' => '/',
  'hsts' => true,
  'hsts.includeSubDomains' => true,
  'hsts.preload' => true,
  'hsts.maxAge' => 31536000,
);

Apache Configuration (/etc/apache2/sites-available/nextcloud.conf)

<VirtualHost 127.0.0.1:8080>
    ServerName cloud.infraviored.lol
    DocumentRoot /var/www/nextcloud/
    <Directory /var/www/nextcloud/>
        Require all granted
        AllowOverride All
        Options FollowSymLinks MultiViews
        <IfModule mod_dav.c>
            Dav off
        </IfModule>
    </Directory>
    SetEnvIf X-Forwarded-Proto "https" HTTPS=on
</VirtualHost>

Nginx Reverse Proxy Configuration

upstream php-handler {
    server 127.0.0.1:8080;
}

server {
    listen 80;
    listen [::]:80;
    server_name cloud.infraviored.lol;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name cloud.infraviored.lol;

    ssl_certificate /etc/letsencrypt/live/cloud.infraviored.lol/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/cloud.infraviored.lol/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header X-Content-Type-Options nosniff;
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Robots-Tag none;
    add_header X-Download-Options noopen;
    add_header X-Permitted-Cross-Domain-Policies none;
    add_header Referrer-Policy no-referrer;

    root /var/www/nextcloud;

    location = /.well-known/carddav {
        return 301 $scheme://$host/remote.php/dav;
    }

    location = /.well-known/caldav {
        return 301 $scheme://$host/remote.php/dav;
    }

    location / {
        proxy_pass http://php-handler;
        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-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;
        
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        proxy_redirect off;
        proxy_buffering off;
        client_max_body_size 0;
        proxy_read_timeout 36000s;
        proxy_send_timeout 36000s;
    }

    location ~* \.(?:css|js|woff|svg|gif)$ {
        expires 6M;
        access_log off;
    }

    location ~* \.(?:png|jpg|jpeg|webp|avif)$ {
        expires 6M;
        access_log off;
    }
}

Conclusion:

Does anyone have an idea of what could be causing these 404 errors for the CSS files and the missing dashboard styles? I’ve been stuck on this for a while and would appreciate any guidance.

Thank you in advance for your help!