Notifications
Clear all
Apr 19, 2024 4:22 am
1. Protect your .env file by adding the following line to your Apache virtual host configuration:
- Path: /etc/apache2/apache2.conf
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
#add following lines:
<Files .env>
Order allow,deny
Deny from all
</Files>
2. Disable the Apache autoindex module to protect your code from being indexed by web browsers:
a2dismod --force autoindex
3. Enable the default Apache configuration to display the default webpage when accessing your server's IP address:
a2ensite 000-default.conf
4. Create an index.html file in your default Apache root directory at path /var/www/html.
By following these steps, you can protect your Laravel environment from hacking attempts aimed at obtaining credentials stored in your .env file. Thank you. 🙂