Change url from example.com/nextcloud to example.com but afterwards error message that ".ocdata" is missing

Nextcloud version : 19.0.2
Operating system and version: Ubuntu 18.04
Apache or nginx version: Nginx
PHP version: 7.4

I have currently nextcloud running on url “server.example.com/nextcloud” and would like to change this to “server.example.com” only. Nextcloud is installed in /var/www/nextcloud and the data is in /var/nextcloud_data. I therefore changed the nginx configuration file but after restarting nginx and try to login by using the new url I receive the error message that .ocdata file is missing in data directory which is not the case. I also changed the overwrite.cli.url in the config.php.

Any help is appreciated.