<div dir="ltr"><div><div><div>Hello.<br><br></div>Perhaphs this can help you about the out of memory: OOM Killer:<br><br><a href="https://www.google.com/search?client=ubuntu&channel=fs&q=OOM+Kiler&ie=utf-8&oe=utf-8">https://www.google.com/search?client=ubuntu&channel=fs&q=OOM+Kiler&ie=utf-8&oe=utf-8</a><br><br></div>Kind regards,<br><br></div>Oscar<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 19, 2015 at 8:02 AM, M. Fioretti <span dir="ltr"><<a href="mailto:mfioretti@nexaima.net" target="_blank">mfioretti@nexaima.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2015-08-18 14:36, Steve Wilson wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
When I migrated from apache+mod_php to nginx+php-fpm I found I had a<br>
few websites using persistent mysql connections which never closed.<br>
</blockquote>
<br></span>
Steve, thanks for this tip. This surely was part of the problem, but<br>
not all of it.<br>
<br>
Sure enough, when I first noticed this problem, I also found in dmesg<br>
messages like this:<br>
<br>
Out of memory: kill process 31066 (mysqld) score 30155 or a child<br>
Killed process 31066 (mysqld)<br>
<br>
yesterday, as soon as I was able to ssh again, I turned<br>
<br>
mysql.allow_persistent = Off in php.ini (it was On)<br>
<br>
and restarted everything. Page load time decreased noticeably AND there<br>
where no more mysql crashes for the rest of the day.<br>
This morning, however, I found mysql died again with the same symptom<br>
(dead but subsystem locked) and a DIFFERENT message in dmesg, that I<br>
had never seen before:<br>
<br>
Out of memory: kill process 13812 (php-fpm) score 18223 or a child<br>
Killed process 13812 (php-fpm)<br>
<br>
the nginx and php-fpm configuration files are pasted below (I have several virtual<br>
hosts all configured that way for wordpress, plus one drupal and one semantic scuttle<br>
site, if it matters). What next? Any help is welcome!<br>
<br>
Marco<br>
<br>
[root@fima ~]# more /etc/nginx/nginx.conf<br>
<br>
user              nginx;<br>
worker_processes  1;<br>
<br>
error_log  /var/log/nginx/error.log;<br>
#error_log  /var/log/nginx/error.log  notice;<br>
#error_log  /var/log/nginx/error.log  info;<br>
<br>
pid        /var/run/nginx.pid;<br>
<br>
<br>
events {<br>
    worker_connections  1024;<br>
}<br>
<br>
http {<br>
    include       /etc/nginx/mime.types;<br>
    default_type  application/octet-stream;<br>
<br>
    server_names_hash_bucket_size  64;<br>
    server_tokens off;<br>
    access_log  /var/log/nginx/access.log combined  buffer=32k;<br>
    log_format    '$remote_addr - $remote_user [$time_local] $status '<br>
                      '"$request" $body_bytes_sent "$http_referer" '<br>
                      '"$http_user_agent" "$http_x_forwarded_for"';<br>
<br>
    sendfile        on;<br>
    #tcp_nopush     on;<br>
<br>
    #keepalive_timeout  0;<br>
    keepalive_timeout  65;<br>
<br>
    #gzip  on;<br>
<br>
    # Load config files from the /etc/nginx/conf.d directory<br>
    # The default server is in conf.d/default.conf<br>
    include /etc/nginx/conf.d/*.conf;<br>
<br>
}<br>
<br>
and this is configuration for one of the wordpress sites, I only changed<br>
the domain name. The configuration is due to the fact that, for several<br>
reasons out of my control, I **must** run two fully independent wordpress<br>
installations, but "nested" into each other, that is:<br>
<br>
<a href="http://myblog.example.com/" rel="noreferrer" target="_blank">myblog.example.com/</a>   (english blog, by wordpress installed in $documentroot/myblog)<br>
<a href="http://myblog.example.com/it" rel="noreferrer" target="_blank">myblog.example.com/it</a> (italian version, by separate wordpress installed in $documentroot/myblog_it)<br>
<br>
the above worked fine with apache. Can the equivalent config for<br>
nginx be related to the problem I'm seeing? If yes, how, and how to<br>
fix it? And while we are at this: advice on anything else I could optimize is<br>
also very welcome of course, even if not related to the main problem.<br>
<br>
<br>
[root@fima ~]# more /etc/nginx/conf.d/stop.conf<br>
<br>
server {<br>
       listen       80;<br>
       server_name  <a href="http://myblog.example.com" rel="noreferrer" target="_blank">myblog.example.com</a>;<br>
       root         /var/www/html/wordpress/;<br>
       include      /etc/nginx/default.d/*.conf;<br>
<br>
       # configuration for the italian version, installed<br>
       # in root/myblog_it, but having as url <a href="http://example.com/stop/it" rel="noreferrer" target="_blank">example.com/stop/it</a><br>
<br>
       location ^~ /it/ {<br>
                rewrite ^/it/(.+) /myblog_it/$1 ;<br>
                index             /myblog_it/index.php;<br>
       }<br>
<br>
       location /myblog_it/ {<br>
                try_files $uri $uri/ /myblog_it/index.php?args;<br>
                index index.php;<br>
                location ~ \.php$ {<br>
                         fastcgi_pass unix:/tmp/phpfpm.sock;<br>
                         fastcgi_index  index.php;<br>
                         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;<br>
                         include        fastcgi_params;<br>
                         }<br>
                }<br>
<br>
##################################################################<br>
# main blog<br>
<br>
        location ^~ / {<br>
                 rewrite ^/(.+) /myblog/$1 ;<br>
                 index          /myblog/index.php;<br>
                 }<br>
<br>
        location /myblog/ {<br>
                 try_files /$uri /$uri/ /myblog/index.php?args;<br>
                 index                        index.php;<br>
                 }<br>
<br>
        location ~ \.php$ {<br>
                 fastcgi_pass unix:/tmp/phpfpm.sock;<br>
                 fastcgi_index  index.php;<br>
                 fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;<br>
                 include        fastcgi_params;<br>
                }<br>
}<br>
<br>
<br>
php-fpm configuration:<br>
<br>
[root ~]# grep -v '^;' /etc/php-fpm.conf | uniq<br>
<br>
include=/etc/php-fpm.d/*.conf<br>
<br>
[global]<br>
pid = /var/run/php-fpm/php-fpm.pid<br>
<br>
error_log = /var/log/php-fpm/error.log<br>
<br>
daemonize = no<br>
<br>
emergency_restart_threshold = 10<br>
emergency_restart_interval = 1m<br>
process_control_timeout = 10s<br>
<br>
AND ALSO:<br>
<br>
[root ~]# grep -v '^;' /etc/php-fpm.d/www.conf | uniq<br>
[www]<br>
<br>
<br>
listen.allowed_clients = 127.0.0.1<br>
<br>
listen = /tmp/phpfpm.sock<br>
listen.owner = nginx<br>
listen.group = nginx<br>
user = nginx<br>
group = nginx<br>
<br>
pm = dynamic<br>
<br>
pm.max_children = 50<br>
<br>
pm.start_servers = 5<br>
<br>
pm.min_spare_servers = 5<br>
<br>
pm.max_spare_servers = 35<br>
<br>
<br>
<br>
<br>
<br>
slowlog = /var/log/php-fpm/www-slow.log<br>
<br>
<br>
php_admin_value[error_log] = /var/log/php-fpm/www-error.log<br>
php_admin_flag[log_errors] = on<br>
<br>
php_value[session.save_handler] = files<br>
php_value[session.save_path] = /var/lib/php/session<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Oscar Fernandez Sierra<br><a href="mailto:oscaretu@gmail.com" target="_blank">oscaretu@gmail.com</a></div>
</div>