user nginx; worker_processes 4; #error_log /var/log/nginx/error.log; error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; events { worker_connections 2048; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] $request ' '"$status" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; server_names_hash_bucket_size 64; #gzip on; server { listen 80; server_name somedomain.com; #access_log /var/www/somedomain.com/log/access main; access_log /var/www/somedomain.com/log/access main; error_log /var/www/somedomain.com/log/error notice; root /var/www/somedomain.com/data; index index.php; location ~ /\.ht { deny all; } location ~* ^.+\.(class|inc)$ { deny all; } location ~* ^\/(\d+)\/(\d+)\/(.+)$ { rewrite ^\/(\d+)\/(\d+)\/(.+)$ /$3?$args last; break; } location ~* ^\/(\d+)\/(\d+)\/?$ { rewrite ^\/(\d+)\/(\d+)\/?$ /index.php?page=$1&aff=$2&$args last; break; } location ~* ^.+\.php$ { fastcgi_pass unix:/tmp/php-fcgi.sock; fastcgi_index index.php; include /etc/nginx/fastcgi.conf; } location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?request_uri=$1 last; break; } } } }