2.检查配置文件语法错误已经重启服务。
[root@lnmp ~]# /usr/local/php-fpm/sbin/php-fpm -t
[18-Dec-2017 18:11:25] NOTICE: configuration file /usr/local/php-fpm/etc/php-fpm.conf test is successful
[root@lnmp ~]# /etc/init.d/php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done
3.配置主机test.com,让它使用的是www连接池
[root@lnmp ~]# vim /usr/local/nginx/conf/vhost/test.com.conf
location ~ \.php$
{
include fastcgi_params;
fastcgi_pass unix:/tmp/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/wwwroot/test.com$fastcgi_script_name;
}
[root@lnmp ~]# vim /data/wwwroot/test.com/sleep.conf
4.检查语法错误,并且重新加载nginx
[root@lnmp test.com]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx//conf/nginx.conf test is successful
[root@lnmp test.com]# /usr/local/nginx/sbin/nginx -s reload
5.我们在test.com的页面里写等待连接,以便观察结果
[root@lnmp test.com]# curl -x127.0.0.1:80 test.com/sleep.php
test slow logdone
[root@lnmp ~]# curl -x127.0.0.1:80 test.com/1.php -I (报错404)
HTTP/1.1 404 Not Found
Server: nginx/1.8.0
Date: Mon, 18 Dec 2017 12:35:09 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.6.30
[root@lnmp ~]# cat /usr/local/php-fpm/var/log/php_errors.log (查看错误日志)
[18-Dec-2017 12:33:51 UTC] PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /data/wwwroot/test.com/1.php on line 2
[18-Dec-2017 12:34:11 UTC] PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /data/wwwroot/test.com/1.php on line 2
[18-Dec-2017 12:35:09 UTC] PHP Warning: Unknown: open_basedir restriction in effect. File(/data/wwwroot/test.com/1.php) is not within the allowed path(s): (/data/wwwroot/wwtest.com:/tmp/) in Unknown on line 0
[18-Dec-2017 12:35:09 UTC] PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
四、php-fpm进程管理
我们打开一个php-fpm的配置文件。