Allow Apache2 only from localhost
If you do not want to expose apache2 to external network, and access only through localhost you can use the following configuration snippet.
Add/Update /etc/apache1/sites-available/000-default.conf
with the following:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order deny,allow
deny from all
allow from 127.0.0.1
</Directory>