How to protect .env file in Laravel

后端 未结 6 971
甜味超标
甜味超标 2021-01-11 11:30

I moved my project to HOST but I can still access .env with address mysite.com/.env and display this file with all variables and secure data. my .env file :

         


        
6条回答
  •  执念已碎
    2021-01-11 11:37

    I have tried following steps to deploy laravel in the shared hosting.

    1 - Edit the /etc/apache2/apache2.conf in Ubuntu OS. Please check appropriate file in other operating systems.

    
            Options Indexes FollowSymLinks
            AllowOverride All # Changed from None to All
            Require all granted
    
    
    1. Enable mod rewrite sudo a2enmod rewrite

    2. Edit or create .htaccess in the root (Public html folder)

       
           Order allow,deny
           Deny from all
       
       Options -Indexes
       
           Order allow,deny
           Deny from all
       
      

    4 - Restart Apache server, sudo service apache2 restart

    Note :- First two steps are used only in my own PC.

提交回复
热议问题