Apache limits on Debian

If you happen to use Debian systems on your webservers, you may have noticed that Apache won’t use the limits specified in /etc/security/limits.conf:

# grep www-data /etc/security/limits.conf 
www-data - nofile 65535
www-data - nproc 65535
# for i in $(pidof apache2); do cat /proc/$i/limits; done | grep files | sort | uniq -c
     34 Max open files            8192                 8192                 files 

The “Debian Way”, as documented on the website, is to specify the limits for Apache in /etc/apache2/envvars:

## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

This requires a full restart, a reload won’t do:

# service apache2 restart
[ ok ] Restarting web server: apache2 ... waiting .
# for i in $(pidof apache2); do cat /proc/$i/limits; done | grep files | sort | uniq -c
     24 Max open files            65536                65536                files

Annoying, isn’t it? :)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s