I encountered a very painful thing, centOS7.2, the lnmp environment installed by yum.
nginx is compiled and installed and placed in the /usr/local/nginx directory.
Problems encountered so far:
1. Starting through service nginx start and service php-fpm start is normal, closing everything is normal, but the php file cannot be found. As long as the php file is accessed, it is file not found, and accessing static files is normal. . There are no errors in the configuration file at all, as shown in 2.
2, start directly through /usr/local/nginx/sbin/nginx, that is, the executable file, and also directly start php-fpm, so there will be no problem, and access to any page will be normal.
3. The weirdest thing is that those opened directly through nginx can only be closed through kill or nginx -s stop, and cannot be closed through service or systemctl, while those opened through service can be closed through nginx -s stop. The same goes for php-fpm.
As follows:
<code>[root@vikie-pc web]# ps -ef |grep php root 4988 1 0 16:24 ? 00:00:00 php-fpm: master process (/etc/php-fpm.conf) www 4989 4988 0 16:24 ? 00:00:00 php-fpm: pool www www 4990 4988 0 16:24 ? 00:00:00 php-fpm: pool www www 4991 4988 0 16:24 ? 00:00:00 php-fpm: pool www www 4992 4988 0 16:24 ? 00:00:00 php-fpm: pool www www 4993 4988 0 16:24 ? 00:00:00 php-fpm: pool www root 5020 1 0 16:25 ? 00:00:00 php-fpm: master process (/etc/php-fpm.conf) www 5028 5020 0 16:25 ? 00:00:00 php-fpm: pool www www 5030 5020 0 16:25 ? 00:00:00 php-fpm: pool www www 5032 5020 0 16:25 ? 00:00:00 php-fpm: pool www www 5033 5020 0 16:25 ? 00:00:00 php-fpm: pool www www 5035 5020 0 16:25 ? 00:00:00 php-fpm: pool www root 5231 27194 0 16:25 pts/1 00:00:00 grep --color=auto php </code>
God, who can help me? It’s been a whole day.
I suspect it may be a problem with user permissions, but I don’t know much about it, so I’m completely confused
I encountered a very painful thing, centOS7.2, the lnmp environment installed by yum.
nginx is compiled and installed and placed in the /usr/local/nginx directory.
Problems encountered so far:
1. Starting through service nginx start and service php-fpm start is normal, closing everything is normal, but the php file cannot be found. As long as the php file is accessed, it is file not found, and accessing static files is normal. . There are no errors in the configuration file at all, as shown in 2.
2, start directly through /usr/local/nginx/sbin/nginx, that is, the executable file, and also directly start php-fpm, so there will be no problem, and access to any page will be normal.
3. The weirdest thing is that those opened directly through nginx can only be closed through kill or nginx -s stop, and cannot be closed through service or systemctl, while those opened through service can be closed through nginx -s stop. The same goes for php-fpm.
As follows:
<code>[root@vikie-pc web]# ps -ef |grep php root 4988 1 0 16:24 ? 00:00:00 php-fpm: master process (/etc/php-fpm.conf) www 4989 4988 0 16:24 ? 00:00:00 php-fpm: pool www www 4990 4988 0 16:24 ? 00:00:00 php-fpm: pool www www 4991 4988 0 16:24 ? 00:00:00 php-fpm: pool www www 4992 4988 0 16:24 ? 00:00:00 php-fpm: pool www www 4993 4988 0 16:24 ? 00:00:00 php-fpm: pool www root 5020 1 0 16:25 ? 00:00:00 php-fpm: master process (/etc/php-fpm.conf) www 5028 5020 0 16:25 ? 00:00:00 php-fpm: pool www www 5030 5020 0 16:25 ? 00:00:00 php-fpm: pool www www 5032 5020 0 16:25 ? 00:00:00 php-fpm: pool www www 5033 5020 0 16:25 ? 00:00:00 php-fpm: pool www www 5035 5020 0 16:25 ? 00:00:00 php-fpm: pool www root 5231 27194 0 16:25 pts/1 00:00:00 grep --color=auto php </code>
God, who can help me? It’s been a whole day.
I suspect it may be a problem with user permissions, but I don’t know much about it, so I’m completely confused
Solved, due to selinux permissions issue, php-fpm access has been blocked. You can turn off selinux or add the php-fpm service to the selinux whitelist
If the static page can be accessed, it is probably because the nginx configuration file is not configured properly. The configuration file is in the nginx installation directory/etc/nginx.conf