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

jove's avatar
Level 7

Correct way to set permissions for Laravel (Linux + SELinux)?

This is what I thought, what should I change?

git clone/pull will be run by root

find /path-to-dir -type f -exec chmod 640 {} \;   
find /path-to-dir -type d -exec chmod 750 {} \;
chown -R nginx:nginx /path-to-dir
semanage fcontext -a -t httpd_sys_content_t "/path-to-dir(/.*)?"
semanage fcontext -a -t httpd_sys_rw_content_t "/path-to-dir/storage(/.*)?"
semanage fcontext -a -t httpd_sys_rw_content_t "/path-to-dir/bootstrap/cache(/.*)?"
semanage fcontext -a -t httpd_sys_rw_content_t "/path-to-dir/vendor(/.*)?"
restorecon -Rv /path-to-dir

composer will by run by nginx along with all artisan commands

0 likes
0 replies

Please or to participate in this conversation.