Hello friends. I'm new to nginx, but I'm also an old dog in terms of hosting/platform/development.
I've just set up the first server with no apache whatsoever, only nginx, php-cgi and mysql.
Here's a typical top screen on the server: http://andresb.net/ab/snaps/344ba90e6cd061fbfc7c71e47fda7f2d.png
The hardware is a low-end dedicated server at JaguarPC.com, dual core AMD cpu, 2Gb RAM, 250Gb HDD, CentOS 5.4.
I just can't bring down the average load, no matter how idle is the CPU and how much available RAM I have. Can you tell if there's something stupidly wrong by just looking at top?
The snapshot was taken at peak hour with a single wordpress site configured on the server getting around 50K visits/day. PHP has APC extension installed and working, Wordpress has WP-Super-Cache enabled and MySql has the my-medium.cnf file and query cache enabled, with around 1000 queries constantly in cache and no lom-mem-prunes. No mail server/traffic. csf firewall on top of iptables and the main server configuration is:
user nobody;
worker_processes 2;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
ignore_invalid_headers on;
limit_zone gulag $binary_remote_addr 1m;
limit_conn gulag 5;
recursive_error_pages on;
sendfile on;
#server_name_in_redirect off;
server_tokens off;
## TCP options
tcp_nodelay on;
tcp_nopush on;
## Compression
gzip on;
gzip_static on;
gzip_buffers 16 8k;
gzip_comp_level 9;
gzip_http_version 1.0;
gzip_min_length 0;
gzip_types text/plain text/css text/javascript application/javascript
application/x-javascript image/x-icon image/bmp;
gzip_vary on;
## Timeouts
client_body_timeout 5;
client_header_timeout 5;
keepalive_timeout 10 10;
send_timeout 5;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass unix:/var/lib/nginx/php_cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
#Virtual hosts
include /etc/nginx/sites/*.conf;
}
Am I being stupid about something?
Cheers,
AndresB