php-fpm pool 설정
php-fpm 설정
[www]
user = nobody
group = nobody
;listen = 127.0.0.1:9000
listen = /var/run/fpm-www.sock
listen.backlog = 4096
listen.owner = nobody
listen.group = nobody
listen.mode = 0660
;listen.allowed_clients = 127.0.0.1
process.priority = -19
pm = dynamic
pm.max_children = 30
pm.start_servers = 6
pm.min_spare_servers = 4
pm.max_spare_servers = 8
pm.process_idle_timeout = 0
pm.max_requests = 500
request_terminate_timeout = 10s
;request_slowlog_timeout = 0
;slowlog = /usr/local/php/var/log/slowlog.log
;rlimit_files = 1024
;rlimit_core = 0
security.limit_extensions = .php .php3 .php4 .php5
catch_workers_output = yes
[www2]
user = nobody
group = nobody
;listen = 127.0.0.1:9000
listen = /var/run/fpm-www2.sock
listen.backlog = 4096
listen.owner = nobody
listen.group = nobody
listen.mode = 0660
;listen.allowed_clients = 127.0.0.1
process.priority = -19
pm = dynamic
pm.max_children = 30
pm.start_servers = 6
pm.min_spare_servers = 4
pm.max_spare_servers = 8
pm.process_idle_timeout = 0
pm.max_requests = 500
request_terminate_timeout = 10s
;request_slowlog_timeout = 0
;slowlog = /usr/local/php/var/log/slowlog.log
;rlimit_files = 1024
;rlimit_core = 0
security.limit_extensions = .php .php3 .php4 .php5
catch_workers_output = yes
nginx php-fpm unix socket upstream
upstream php {
server unix:/var/run/fpm-www.sock max_fails=5 fail_timeout=5;
server unix:/var/run/fpm-www2.sock max_fails=5 fail_timeout=5;
}
php-fpm 의 unix socket 을 두 개 생성해 사용하도록 함. fastcgi_pass php; 로 설정해 upstream 사용하도록 함
nginx fastcgi 관련 설정
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 512k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_max_temp_file_size 0;
fastcgi_pass php;
시스템 설정 변경
sysctl -w fs.file-max=2097080
sysctl -w net.core.somaxconn=65536
sysctl -w net.ipv4.tcp_max_syn_backlog=65536
sysctl -w net.core.netdev_max_backlog=65536