I am working on a Laravel project where I have to generate a Nginx configuration file and store it on /etc/nginx/sites-available
directory which only has write rights for the admin user, I have admin rights on the server, I just want to know if there is a way for doing this using the Process Component of Symfony stack.
Thanks a lot and bests ;)
I would recommend using linux ACL, and give PHP process rights to write into the directory. That way you don't need sudo.
Also, you will need rights to reload the nginx process. And imho having a cronjob under root user, that reloads the configuration, if it changes and is valid, is a much better option.
You should read the relevant answers, that suggest not having rights to do a sudo call from PHP, for example
Just don't do it. Find a workaround that doesn't require sudo permissions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With