What is the essence of the problem?
Generally, we use redhat system such as centos yum, debian system apt-get to install nginx. Generally, the sbin directory and conf directory are separated, so the security dog cannot find the nginx directory, and it does not work when we enter the directory manually. (As shown in the picture below), because only one directory can be entered at a time, I have encountered this problem once before, on the centos server. At that time, cloud lock was used instead of the security dog. This time I explored the solution myself
So how did I solve it
The following takes ubuntu as an example
Since they are separated, can we merge them? (Using soft connections of course)
First look where are they?
whereis nginx
For example, we want to merge them in /usr/local/nginx
cd /usr/local/nginx/ sudo ln -s /usr/sbin/ ./sbin sudo ln -s /etc/nginx ./conf
Then start the safe dog’s py installation script again
There is a new problem, it seems that nginx is down
Restart the server, but it still doesn’t work. Use the following command to check why it can’t be restarted
sudo nginx -t
Create it if it doesn’t exist
cd /usr/local/nginx sudo mkdir logs cd logs/ sudo touch error.log sudo service nginx restart
Open your own website to test it, it’s successful, haha~ ~~
The above introduces how to install security dog when the sbin and conf files of nginx are not in the same directory, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.