Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tovisbratsburg's avatar

Apache Settings

Which is correct, or are both wrong?

    ServerAdmin [email protected]
    DocumentRoot /var/www/laravel/public

    <Directory /var/www/laravel>
	Options Indexes FollowSymLinks
    	AllowOverride All
    	Require all granted
</Directory>

-or-

    ServerAdmin [email protected]
    DocumentRoot /var/www/laravel/public

    <Directory /var/www/laravel/public>
	Options Indexes FollowSymLinks
    	AllowOverride All
    	Require all granted
</Directory>
0 likes
4 replies
MarianoMoreyra's avatar
Level 25

Hi @tovisbratsburg

The second one is the right one for two reasons:

  1. You need to have a <Directory> block matching your DocumentRoot in order to configure it
  2. You don't want to allow anything at /var/www/laravel as there is where it lives your .env file with all your sensitive credentials!

Hope this helps!

tovisbratsburg's avatar

Thanks, routes were not working so I switched it to this:

<Directory /var/www/laravel/public/>
	Options Indexes FollowSymLinks
	AllowOverride All
	Order allow,deny
	allow from all
	Require all granted
</Directory>

Please or to participate in this conversation.