500 after install - Class Magento\Framework\App\ResourceConnection\Proxy does not exist

chown -R www-data:www-data /var/www/magento2/ 
chmod 777 -R var
chmod 777 -R generated
chmod 777 -R app/etc
rm -rf var/cache/* var/page_cache/* var/generation/*

and

php bin/magento setup:di:compile;

Delete composer autoload (vendor/autoload.php) as suggested by @JELLEJ and type composer install in magento root folder to recreate it.

It worked for me on Magento 2.3.5-p1 (but should work in other versions).


several classes in Magento2 are generated dynamically. Except you are in Developer mode, this does not happen automatically.

To activate the developer Mode, you have to uncomment the Line in the beginning of your .htaccess file.

For production and default mode you have to execute the command bin/magento setup:di:compile from your magento root to generate the classes