Answer the question
In order to leave comments, you need to log in
Restarting nginx from php - how?
I can't get nginx restart from php (php under apache) in any way.
I tried shell_exec("sudo /etc/init.d/nginx reload"), having previously added this command to /etc/sudoers, but sudo does nothing through shell_exec, everything is ok through the console.
Then I decided to go with the cron + bash method, with the creation of the .go_restart file via php: I
run the script using cron, it works as it should via the console, when launched via cron, the .go_restart file itself is deleted, but nginx does not restart.
if [ -f <...>/.go_restart ];
then
rm -f <...>/.go_restart;
service nginx reload
fi
Answer the question
In order to leave comments, you need to log in
Solved the problem - disabled SElinux for apache, commented out #Defaults requiretty
in /etc/sudoers.
Thanks to all.
I'm not very knowledgeable, but why reload and not restart?
service nginx restart
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question