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

jackelofnar's avatar

Is there a way to make laravel sail use a different path

Hi, Is there a way to make Laravel sail use a different path than /var/www? Unfortunately I need to use /srv/html but i've gone over config files, documentation and cannot find anything.

0 likes
14 replies
Tray2's avatar

Take a look in the docker files and see if you can find the reference to the nginx settings, where you are able to define which directory to serve the files from, but why are you trying to do that, it makes no sense?

jackelofnar's avatar

@Tray2 Only place i've been able to find to change the config is laravel.test but this had no effect

Tray2's avatar

@jackelofnar You need to publish the vendor files for Sail, and then you can update the workspace folder.

Tray2's avatar

@jackelofnar Yes, and that is not what I'm talking about, I'm talking about running the php artisan vendor:publish command.

Tray2's avatar

@jackelofnar That doesn't matter, you don't use sail in production, as long as the web server knows where it is stored you don't need to do anything.

jackelofnar's avatar

@Tray2 a base laravel install gives me the error "The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log:". When i did this on a local setup everything worked fine

Tray2's avatar

@jackelofnar That is a permission issue, you need to make sure www-data is allowed to write to the storage directory, this is usually done by setting the chmod on the directory and all it's content.

sudo chmod -R 755 /var/www/html/storage

Tray2's avatar

@jackelofnar The Sail image does, and it shouldn't have your permission issues either.

The path for the document root doesn't matter, it could be /var/www/, /srv/www or whatever else you want it to be, as long as you have configured the virtual host to point to it.

jackelofnar's avatar

@Tray2 wish it was that simple or maybe i am missing something. /srv/http is empty and all error point to /var/www/html/

jackelofnar's avatar

For those interested i fixed the issue by doing the following cd laravel-app/storage mkdir -pv framework/views app framework/sessions framework/cache cd .. chmod -R 777 storage

Please or to participate in this conversation.