nginxnextcloud

500 Error for some ajax calls on my self hosted Nextcloud server


I have installed Nextcloud version 28.0.1 on my Ubuntu 22.04 server and using Nginx.

I am getting a 500 error for some Ajax calls for example rooms and files but not getting any error messages in my error logs: enter image description here enter image description here

I don't know what I am missing to let that properly work and switching to Apache is not an option because I have other projects already running on my server with nginx. Here is my nginx nextcloud.conf:

server {
    server_name nextcloud.my_domain.net;

    root /var/www/nextcloud;
    index index.php;

    error_log /var/log/nginx/nextcloud-error.log;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php(?:$|/) {
        # Required for legacy support
        rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode\/proxy) />

        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        set $path_info $fastcgi_path_info;

        try_files $fastcgi_script_name =404;

        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param HTTPS on;

        fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twice
        fastcgi_param front_controller_active true;     # Enable pretty urls
        fastcgi_pass php-handler;

        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;

        fastcgi_max_temp_file_size 0;
    }

    # Serve static files
    location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
        try_files $uri /index.php$request_uri;
        add_header Cache-Control "public, max-age=15778463, $asset_immutable";
        access_log off;     # Optional: Don't log access to assets

        location ~ \.wasm$ {
            default_type application/wasm;
        }
    }

    location ~ \.woff2?$ {
        try_files $uri /index.php$request_uri;
        expires 7d;         # Cache-Control policy borrowed from `.htaccess`
        access_log off;     # Optional: Don't log access to assets
    }

    location ~ /\.ht {
        deny all;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /path/to/fullchain.pem; # managed by Certbot
    ssl_certificate_key /path/to/nextcloud.bizarre-door.net/privkey.pem; # managed by Certbot
    include /path/to/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /path/to/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = nextcloud.my_domain.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    server_name nextcloud.my_domain.net;
    return 301 https://$host$request_uri; # managed by Certbot
}

If I am lacking on information please let me know.

Update 24.01.2024 09:7 CET

My apologies. I have found the nextcloud.log inside the nextcloud folder in data. This is the last log (tried to make it more readable):

{"reqId":"P71yzftqBFEex4yvxBVR","level":3,"time":"2024-01-24T08:01:16+00:00","remoteAddr":"imagine_an_IP","user":"user","app":"no app in context",
"method":"GET","url":"/ocs/v2.php/apps/spreed/api/v4/room?includeStatus=true","message":"Exception thrown: Exception",
"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 OPR/105.0.0.0","version":"28.0.1.1",
"exception":{"Exception":"Exception","Message":"Class \"IntlBreakIterator\" not found in file '/var/www/nextcloud/lib/private/EmojiHelper.php' line 45","Code":0,"Trace":
[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},
{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/ocs/v1.php","line":65,"function":"match","class":"OC\\Route\\Router","type":"->"},
{"file":"/var/www/nextcloud/ocs/v2.php","line":23,"args":["/var/www/nextcloud/ocs/v1.php"],"function":"require_once"}],
"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"Line":169,"Previous":{"Exception":"Error","Message":"Class \"IntlBreakIterator\" not found","Code":0,"Trace":
[{"file":"/var/www/nextcloud/apps/spreed/lib/Service/AvatarService.php","line":347,"function":"isValidSingleEmoji","class":"OC\\EmojiHelper","type":"->"},
{"file":"/var/www/nextcloud/apps/spreed/lib/Service/RoomFormatter.php","line":151,"function":"getAvatarVersion","class":"OCA\\Talk\\Service\\AvatarService","type":"->"},
{"file":"/var/www/nextcloud/apps/spreed/lib/Service/RoomFormatter.php","line":81,"function":"formatRoomV4","class":"OCA\\Talk\\Service\\RoomFormatter","type":"->"},
{"file":"/var/www/nextcloud/apps/spreed/lib/Controller/RoomController.php","line":439,"function":"formatRoom","class":"OCA\\Talk\\Service\\RoomFormatter","type":"->"},
{"file":"/var/www/nextcloud/apps/spreed/lib/Controller/RoomController.php","line":241,"function":"formatRoom","class":"OCA\\Talk\\Controller\\RoomController","type":"->"},
{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getRooms","class":"OCA\\Talk\\Controller\\RoomController","type":"->"},
{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},
{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},
{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},
{"file":"/var/www/nextcloud/ocs/v1.php","line":65,"function":"match","class":"OC\\Route\\Router","type":"->"},
{"file":"/var/www/nextcloud/ocs/v2.php","line":23,"args":
["/var/www/nextcloud/ocs/v1.php"],"function":"require_once"}],
"File":"/var/www/nextcloud/lib/private/EmojiHelper.php","Line":45},"CustomMessage":"Exception thrown: Exception"}}

Solution

  • I found the solution for my problem. I needed php-intl but because I have more then one php version I needed to specify the version:

    sudo apt-get install php8.2-intl
    

    After that restart I needed to restart my php and nginx.

    sudo service php8.2-fpm restart
    sudo service nginx restart