CharlyBr on Mar 20th, 2009Permanent redirect with nginx
server {
server_name domain.com;
rewrite ^(.*)$ http://www.domain.com$1 permanent;
}
CharlyBr on Mar 13th, 2009Memory usage by group of processes
While monitoring a http/php server, I needed to do some statistics about php-cgi memory usage.
Playing with memory_limit in PHP, we wanted to know the average memory usage per php-cgi process. This is easily calculated with our best friend awk.
First, get the number of php running processes:
# ps aux | grep php-cgi | grep -v grep [...]
CharlyBr on Mar 12th, 2009permanently load enable HTTP Accept Filter FreeBSD kernel module (accf_http)
While reading articles about optimization, I read about the accf_http module.
The man page of the module is here, where you can read:
The utility of accf_http is such that a server will not have to context switch several times before performing the initial parsing of the request.
To load this module, use the following command:
# kldload accf_http
To [...]
CharlyBr on Mar 11th, 2009Munin and Use of uninitializer value in eval
On some of freshly installed servers (Debian Etch), I encountered these error messages in /var/log/munin/munin-node.log:
Use of uninitialized value in eval {block} exit at /usr/sbin/munin-node line 456, <CHILD> line 8.
What a great error message
After digging into Google results, I found it was just a problem with host_name variable in the configuration. Default value is [...]
CharlyBr on Mar 9th, 2009Nginx and worker_connections are more than open file resource limit warning
If you encounter this warning message under Linux:
2009/03/09 21:23:19 [warn] 26827#0: 4096 worker_connections are more than open file resource limit: 1024
A solution is to use the command ulimit in nginx start script, just before lunching nginx:
[...]
ulimit -n 65536
[...]