PHP-FPM pool 설정
PHP 5.4 버전의 PHP-FPM 기본 설정값. 다음에 설정을 변경하게 되면 참고하기 위해 기록으로 남겨둔다.
[www]
user = nobody
group = nobody
;listen = 127.0.0.1:9000
listen = /var/run/fpm-www.sock
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 = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 15
pm.process_idle_timeout = 10s
pm.max_requests = 500
request_terminate_timeout = 10s
rlimit_files = 1024
rlimit_core = 0
security.limit_extensions = .php .php3 .php4 .php5
catch_workers_output = yes
두 번째 세팅
[www]
user = nobody
group = nobody
;listen = 127.0.0.1:9000
listen = /var/run/fpm-www.sock
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 = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 15
pm.process_idle_timeout = 2s
pm.max_requests = 500
request_terminate_timeout = 0
request_slowlog_timeout = 0
slowlog = /usr/local/php/var/log/sir.co.kr.slowlog.log
;rlimit_files = 1024
;rlimit_core = 0
security.limit_extensions = .php .php3 .php4 .php5
catch_workers_output = yes
두번 째 세팅에 nginx 설정 중 fastcgi 관련 설정을 아래와 같이 변경함
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri /index.php;
fastcgi_cache off;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_index index.php;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
fastcgi_max_temp_file_size 0;
include fastcgi_params;
fastcgi_pass unix:/var/run/fpm-www.sock;
include mime.types;
}
Unix Socket 을 통한 접속 제한이 128 이라고 해서 아래와 같이 확인 후 1024 로 변경
# cat /proc/sys/net/core/somaxconn
128
# sysctl -w net.core.somaxconn=1024
net.core.somaxconn = 1024
그리고 아래 내용을 /etc/sysctl.conf 에 추가
net.core.somaxconn = 1024