If you are using a cloud based preconfigured LAMP image to set up a Server, chances are you will run into problems using Magento 2.
Even when you do everything by the official Magento documentation, you might end up with the rewrites not working. This will show itself with the magento admin panel not being accessible and most pictures, CSS and JS files not being loaded in the front end. The problem seems to be that despite apache rewrites module being active, it doesn’t seem to really do its job. The solution was to disable and re-enable the apache rewrites module and it worked:
1 2 3
sudo a2dismod rewrite sudo a2enmod rewrite sudo service apache2 restart