1

Настроил сервер на debian jessie. Установлено:

nginx version: nginx/1.8.0
PHP 5.6.9-0+deb8u1 (cli) (built: Jun  5 2015 11:03:27)

Организована связка так:

location ~ \.php$ {

fastcgi_split_path_info  ^(.+\.php)(.*)$;
fastcgi_pass    127.0.0.1:9000;
    #fastcgi_pass  unix:/var/run/php5-fpm.sock;
    include fastcgi_params;
    fastcgi_param       SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param REMOTE_ADDR $remote_addr;
    # PATH_INFO и PATH_TRANSLATED могут быть опущены, но стандарт RFC 3875 определяет для CGI
    fastcgi_param  PATH_INFO        $fastcgi_path_info;
    fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_script_name;
    fastcgi_read_timeout 300;

Время загрузки страниц сайта около 30 секунд. Для теста создал test.php с одной строчкой "echo 123;". 15-20 секунд ответ сервера. Много гуглил, много эксперементировал с настройками fpm, но результат не изменяется. Куда еще посмотреть?

/var/log/nginx/error.log

2015/06/25 13:17:39 [alert] 30302#30302: *11394 open socket #60 left in connection 78
2015/06/25 13:17:39 [alert] 30302#30302: *11403 open socket #76 left in connection 86
2015/06/25 13:17:39 [alert] 30302#30302: *11771 open socket #94 left in connection 101
2015/06/25 13:17:39 [alert] 30302#30302: aborting
2015/06/25 13:23:16 [alert] 32173#32173: *4658 open socket #23 left in connection 17
2015/06/25 13:23:16 [alert] 32167#32167: *3854 open socket #24 left in connection 41
2015/06/25 13:23:16 [alert] 32173#32173: *4611 open socket #64 left in connection 43
2015/06/25 13:23:16 [alert] 32173#32173: *4661 open socket #68 left in connection 47
2015/06/25 13:23:16 [alert] 32167#32167: aborting
2015/06/25 13:23:16 [alert] 32173#32173: aborting
2015/06/25 13:23:53 [alert] 961#961: *180 open socket #33 left in connection 8
2015/06/25 13:23:53 [alert] 962#962: *509 open socket #29 left in connection 7
2015/06/25 13:23:53 [alert] 961#961: *339 open socket #57 left in connection 35
2015/06/25 13:23:53 [alert] 962#962: *536 open socket #30 left in connection 9
2015/06/25 13:23:53 [alert] 961#961: *341 open socket #58 left in connection 36
2015/06/25 13:23:53 [alert] 962#962: *554 open socket #32 left in connection 10
2015/06/25 13:23:53 [alert] 961#961: aborting
2015/06/25 13:23:53 [alert] 962#962: aborting

tail -50 /var/log/php5-fpm.log

[25-Jun-2015 13:00:17] NOTICE: [pool www] child 25595 exited with code 0 after 1949.912319 seconds from start
[25-Jun-2015 13:00:17] NOTICE: [pool www] child 26970 started
[25-Jun-2015 13:00:36] NOTICE: [pool www] child 25610 exited with code 0 after 1963.430992 seconds from start
[25-Jun-2015 13:00:36] NOTICE: [pool www] child 26994 started
[25-Jun-2015 13:01:42] NOTICE: [pool www] child 25590 exited with code 0 after 2039.416889 seconds from start
[25-Jun-2015 13:01:42] NOTICE: [pool www] child 30199 started
[25-Jun-2015 13:01:53] NOTICE: [pool www] child 25604 exited with code 0 after 2041.622595 seconds from start
[25-Jun-2015 13:01:53] NOTICE: [pool www] child 30200 started
[25-Jun-2015 13:02:06] NOTICE: [pool www] child 25805 exited with code 0 after 1380.138459 seconds from start
[25-Jun-2015 13:02:06] NOTICE: [pool www] child 30210 started
[25-Jun-2015 13:02:18] NOTICE: [pool www] child 25582 exited with code 0 after 2079.261857 seconds from start
[25-Jun-2015 13:02:18] NOTICE: [pool www] child 30220 started
[25-Jun-2015 13:02:19] NOTICE: [pool www] child 25577 exited with code 0 after 2082.618852 seconds from start
[25-Jun-2015 13:02:19] NOTICE: [pool www] child 30221 started
[25-Jun-2015 13:02:35] NOTICE: [pool www] child 25486 exited with code 0 after 2547.216388 seconds from start
[25-Jun-2015 13:02:35] NOTICE: [pool www] child 30222 started
[25-Jun-2015 13:02:40] NOTICE: [pool www] child 25587 exited with code 0 after 2098.278808 seconds from start
[25-Jun-2015 13:02:40] NOTICE: [pool www] child 30230 started
[25-Jun-2015 13:03:07] NOTICE: [pool www] child 25720 exited with code 0 after 1823.929943 seconds from start
[25-Jun-2015 13:03:07] NOTICE: [pool www] child 30250 started
[25-Jun-2015 13:03:13] NOTICE: [pool www] child 25756 exited with code 0 after 1615.115781 seconds from start
[25-Jun-2015 13:03:13] NOTICE: [pool www] child 30277 started
[25-Jun-2015 13:04:01] NOTICE: Terminating ...
[25-Jun-2015 13:04:01] NOTICE: exiting, bye-bye!
[25-Jun-2015 13:04:01] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

[25-Jun-2015 13:04:01] NOTICE: fpm is running, pid 30330
[25-Jun-2015 13:04:01] NOTICE: ready to handle connections
[25-Jun-2015 13:04:01] NOTICE: systemd monitor interval set to 10000ms
[25-Jun-2015 13:04:21] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 9 idle, and 36 total children
[25-Jun-2015 13:04:57] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 8 idle, and 53 total children
[25-Jun-2015 13:05:21] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 9 idle, and 78 total children
[25-Jun-2015 13:05:48] WARNING: [pool www] server reached pm.max_children setting (100), consider raising it
[25-Jun-2015 13:08:12] NOTICE: [pool www] child 30423 exited with code 0 after 186.354920 seconds from start
[25-Jun-2015 13:08:12] NOTICE: [pool www] child 30528 started
[25-Jun-2015 13:14:01] NOTICE: Terminating ...
[25-Jun-2015 13:14:01] NOTICE: exiting, bye-bye!
[25-Jun-2015 13:21:49] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

[25-Jun-2015 13:21:49] NOTICE: fpm is running, pid 844
[25-Jun-2015 13:21:49] NOTICE: ready to handle connections
[25-Jun-2015 13:21:49] NOTICE: systemd monitor interval set to 10000ms
[25-Jun-2015 13:23:06] NOTICE: Term

inating ... [25-Jun-2015 13:23:06] NOTICE: exiting, bye-bye! [25-Jun-2015 13:23:06] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

[25-Jun-2015 13:23:06] NOTICE: fpm is running, pid 920 [25-Jun-2015 13:23:06] NOTICE: ready to handle connections [25-Jun-2015 13:23:06] NOTICE: systemd monitor interval set to 10000ms [25-Jun-2015 13:24:06] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

6
  • Статика через nginx отдается очень быстро
    – ilyaplot
    24 июн 2015 в 11:47
  • логи nginx-а и php надо смотреть. вероятнее всего, там обнаружатся сообщения об ошибках. 24 июн 2015 в 14:00
  • Сейчас после перезапуска fpm все работает отлично, а через пару минут страницы обрабатываются по 30 секунд, либо вообще 504. la сервера при этом 1-2
    – ilyaplot
    25 июн 2015 в 11:45
  • top какой-нибудь загрузки не показывает?
    – etki
    25 июн 2015 в 11:46
  • нет, ничего необычного. Mysql много кушает, но он в данный момент не участвует в связке. В данный момент load average 1.7, а страницы не грузятся
    – ilyaplot
    25 июн 2015 в 11:49

1 ответ 1

2

Попробуй через unix socket

fastcgi_pass unix:/var/run/php5-fpm.sock;

2
  • Постарайтесь писать более развернутые ответы. Поясните, на чем основано ваше утверждение? 2 июл 2015 в 8:16
  • Через юникс-сокет сейчас и работает. Разницы особой не наблюдаю
    – ilyaplot
    2 июл 2015 в 16:29

Ваш ответ

Нажимая на кнопку «Отправить ответ», вы соглашаетесь с нашими условиями использования и подтверждаете, что прочитали и поняли наши политику конфиденциальности и нормы поведения.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.