Topic: Easily add additional websites -- encountered 'php-fpm Induced OOM'

- iRedMail version (check /etc/iredmail-release): 0.9.8 MARIADB edition
- Linux/BSD distribution name and version: CentOS 7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

"kernel: php-fpm invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0"


I've found a very easy way to add websites to a brand new NGINX iRedMail installation, but ran into an out of memory error shortly after I went live with the site.  I restarted the server after each OOM, but the problem persisted with each reboot.

For everyone, here's how I easily added a site to Nginx.  I post this because I couldn't find much after searching the forum:

------------------------------- NEW SITE CONFIGURATION -------------------------------

1. Install a brand new instance of iRedMail and iRedAdmin-Pro on a new server
2. go to /etc/nginx/sites-available
3. copy the file 00-default-ssl.conf to template.conf
4. make template.conf look like this to use iRedMail's configuration:
NOTE: the location string is for permalinks within Wordpress

server {
    listen 443;
    server_name template.com www.template.com;

    root /var/www/html/template.com;
    index index.php index.html;

    include /etc/nginx/templates/misc.tmpl;
    include /etc/nginx/templates/ssl.tmpl;
    include /etc/nginx/templates/php-catchall.tmpl;

location / {
            try_files $uri $uri/ /index.php?$args;


5. create a link in sites-enabled using this command:
sudo ln -s /etc/nginx/sites-available/template.com.conf /etc/nginx/sites-enabled/template.com.conf
NOTE: change 'template' to whatever your site is
6. restart Nginx using this command:
sudo service nginx restart
7. Change your DNS address to your new server (through your DNS service)
8. Add ssl certificates with certbot using this command:
sudo certbot --nginx -d yoursite.com
NOTE: if it's not installed, you'll have to add certbot using these commands:
sudo yum -y install epel-release
suto yum -y install python2-certbot-nginx
NOTE: select option #2 when you run the certbot command to redirect automatically.
9. restart Nginx
10. If you're using Wordpress, make sure you add the database to your site

------------------------------- END NEW SITE CONFIGURATION -------------------------------

Now for the problem... the new site will run just fine for a couple hours, but then will induce the OOM error.  The line from /var/log/messages reads like this:

"kernel: php-fpm invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0"

Reading from searches, it looks like I can limit the connections to possibly stop this problem, but I wanted to ask on here to see if anyone is familiar with this, and if there is an elegant fix for the problem.  I have moved my sites back to my Apache server until I can figure this out.

thanks for the help!


Re: Easily add additional websites -- encountered 'php-fpm Induced OOM'

Does disable OOM in kernel work for you? in /etc/sysctl.conf:

vm.overcommit_memory = 2
vm.overcommit_ratio = 80


Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee