Last active
August 6, 2020 13:05
-
-
Save ssv445/db3d7160a9c34fb1c25dd243bf5c1839 to your computer and use it in GitHub Desktop.
Laravel Apache hide .env and several security settings via .htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disable Directory listing | |
Options -Indexes | |
# block files which needs to be hidden // in here specify .example extension of the file | |
<Files ~ "\.(env|json|config.js|md|gitignore|gitattributes|lock)$"> | |
Order allow,deny | |
Deny from all | |
</Files> | |
# in here specify full file name sperator '|' | |
<Files ~ "(artisan)$"> | |
Order allow,deny | |
Deny from all | |
</Files> | |
<Files *.php> | |
Order Deny,Allow | |
Deny from all | |
</Files> | |
<Files index.php> | |
Order Allow,Deny | |
Allow from all | |
</Files> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
DocumentRoot /var/www/fake_folder | |
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn, | |
# error, crit, alert, emerg. | |
# It is also possible to configure the loglevel for particular | |
# modules, e.g. | |
#LogLevel info ssl:warn | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_ssl.c> | |
<VirtualHost _default_:443> | |
ServerAdmin webmaster@localhost | |
DocumentRoot /var/www/fake_folder | |
SSLEngine on | |
SSLCertificateFile /var/www/fake_folder/ssl/ssl.cert | |
SSLCertificateKeyFile /var/www/fake_folder/ssl/ssl.kety | |
</VirtualHost> | |
</IfModule> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment