基本信息

php配置目录:/www/server/php/72/etc/

Nginx配置目录:/www/server/nginx/conf

PHP性能调整(有效减少502错误及非网络卡顿)
备份配置文件

备份php配置目录下配置文件:php-fpm.conf

[root@iZxei4e66nioliZ etc]# cp /www/server/php/72/etc/php-fpm.conf{,.bak}
[root@iZxei4e66nioliZ etc]# vim /www/server/php/72/etc/php-fpm.conf
修改php配置文件

编辑php配置目录下配置文件:php-fpm.conf添加如下内容:

;#####首页请求#####
[blog_ymcc_1]
listen.owner = www
listen.group = www
listen = /dev/shm/blog_ymcc_1
user = www
group = www
listen.backlog = 1024
pm = static
pm.max_children = 2
pm.process_idle_timeout = 10s;
pm.max_requests = 128
request_terminate_timeout = 120

[blog_ymcc_2]
listen.owner = www
listen.group = www
listen = /dev/shm/blog_ymcc_2
user = www
group = www
listen.backlog = 1024
pm = static
pm.max_children = 1
pm.process_idle_timeout = 10s;
pm.max_requests = 128
request_terminate_timeout = 120

[blog_ymcc_3]
listen.owner = www
listen.group = www
listen = /dev/shm/blog_ymcc_3
user = www
group = www
listen.backlog = 1024
pm = static
pm.max_children = 2
pm.process_idle_timeout = 10s;
pm.max_requests = 128
request_terminate_timeout = 120

[blog_ymcc_4]
listen.owner = www
listen.group = www
listen = /dev/shm/blog_ymcc_4
user = www
group = www
listen.backlog = 1024
pm = static
pm.max_children = 3
pm.process_idle_timeout = 10s;
pm.max_requests = 128
request_terminate_timeout = 120

[blog_ymcc_5]
listen.owner = www
listen.group = www
listen = /dev/shm/blog_ymcc_5
user = www
group = www
listen.backlog = 1024
pm = static
pm.max_children = 2
pm.process_idle_timeout = 10s;
pm.max_requests = 128
request_terminate_timeout = 120
;#####首页请求!#####

重启php服务

nginx侧修改

编辑Nginx配置目录下nginx.conf配置文件,在http{}内添加如下内容:

        #后端服务
        upstream WebStie_php_Server{
          server unix:/dev/shm/blog_ymcc_1;
          server unix:/dev/shm/blog_ymcc_2;
          server unix:/dev/shm/blog_ymcc_3;
          server unix:/dev/shm/blog_ymcc_4;
          server unix:/dev/shm/blog_ymcc_5;
        }

编辑Nginx配置目录下enable-php-72.conf配置文件并修改成如下内容:

	location ~ [^/]\.php(/|$)
	{
		try_files $uri =404;
		#fastcgi_pass  unix:/tmp/php-cgi-72.sock;
		fastcgi_pass  WebStie_php_Server;
		fastcgi_index index.php;
		include fastcgi.conf;
		include pathinfo.conf;
	}

重启Nginx服务

删除云服务商监控服务(占用CPU&内存)
阿里云
[root@iZxei4e66nioliZ ~]# rm -rf /usr/local/aegis

待持续更新~


该文章采用「CC 协议」,转载必须注明作者和本文链接.
分类: Linux