user site site;
worker_processes 2; # last value 8
error_log /var/log/nginx-error.log info;
#[info | error | debug]
events {
worker_connections 4096;
use kqueue;
# multi_accept on;
}
http {
include mime.types;
include proxy.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local]
$status '
'"$request" $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;
tcp_nodelay on;
server_names_hash_bucket_size 64;
reset_timedout_connection on;
keepalive_timeout 65;
# gzip on;
# gzip_min_length 0;
# gzip_proxied any;
# gzip_types text/html text/plain text/css application/x-
javascript
application/xml;
upload_progress proxied 1m;
#Fixing hw lb errors
geo $lb {
default 0;
192.168.100.130 1; # LB IPs
}
server {
listen 80;
server_name site.com www.site.com;
access_log /usr/local/www/log/nginx-www.site.com-
access.log main;
# Main location
location / {
proxy_pass http://127.0.0.1:8080/;
track_uploads proxied 30s;
}
# Static files location
location ~ ^/(images|javascript|js|css|flash|media|
static)/ {
root /usr/local/www/www/;
expires 30d;
}
# Upload progress
location ^~ /progress {
report_uploads proxied;
}
# Server status
location /status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
# Error pages
error_page 400 /400;
# 400
location = /400 {
if ($lb) {
access_log off;
}
return 400;
}
}
server {
listen 80;
server_name www1.site.com;
#access_log /usr/local/www/log/nginx-www.site.com-two-
access.log main;
# Main location
location / {
proxy_pass http://127.0.0.1:8080/;
track_uploads proxied 30s;
}
# Static files location
location ~ ^/(images|javascript|js|css|flash|media|
static)/ {
root /usr/local/www/www1/;
expires 30d;
}
# Upload progress
location ^~ /progress {
report_uploads proxied;
}
# Server status
location /status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
# Error pages
error_page 400 /400;
# 400
location = /400 {
if ($lb) {
access_log off;
}
return 400;
}
}
}