Если вы посмотрите, и что нибудь подскажете, я буду благодарен, т.к. с нджинксом только недавно начал работать.
nginx.conf
[code]
user www-data;
worker_processes 8;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 10024;
# multi_accept on;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
[/code]
}
и site.com
[code]
log_format dlog '$remote_addr [$time_local] "$request" $status $body_bytes_sent '
'upstream_response_time $upstream_response_time '
'msec $msec request_time $request_time-->$upstream_addr';
#---$http_user_agent';
error_page 403 404 /usr/local/nginx/html/404.html;
proxy_buffer_size 8k;
proxy_buffers 48 8k;
proxy_busy_buffers_size 192k;
proxy_temp_file_write_size 128k;
upstream backend_80 {
ip_hash;
server d1:8081 max_fails=3 fail_timeout=30s;
server d2:8081 max_fails=3 fail_timeout=30s;
server d3:8081 max_fails=3 fail_timeout=30s;
server d4:8081 max_fails=3 fail_timeout=30s;
}
upstream backend_443 {
ip_hash;
server d1:8081 max_fails=3 fail_timeout=30s;
server d2:8081 max_fails=3 fail_timeout=30s;
server d3:8081 max_fails=3 fail_timeout=30s;
server d4:8081 max_fails=3 fail_timeout=30s;
}
server {
server_name d.site.com;
access_log /var/log/nginx/d-access.log dlog;
gzip on;
gzip_min_length 200;
gzip_types text/plain text/xml text/css application/x-javascript application/rss+xml;
gzip_proxied any;
gzip_disable "msie6";
gzip_comp_level 3;
gzip_vary on;
gzip_http_version 1.0;
keepalive_timeout 60;
location /login/validate { return 444; access_log off;}
location /server-status { return 444; access_log off;}
location = /stats {
ustats on;
#ustats_html_table_width 50;
#ustats_html_table_height 50;
access_log off;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpass;
}
location / {
proxy_pass http://backend_80;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 443;
server_name d.site.com;
gzip on;
gzip_min_length 200;
gzip_types text/plain text/xml text/css application/x-javascript application/rss+xml;
gzip_proxied any;
gzip_disable "msie6";
gzip_comp_level 3;
gzip_vary on;
gzip_http_version 1.0;
keepalive_timeout 60;
ssl on;
access_log /var/log/nginx/d-access.log dlog;
ssl_certificate /etc/nginx/conf.d/ssl/crt/public.crt;
ssl_certificate_key /etc/nginx/conf.d/ssl/private/d.site.com.key_nopasshphrase.org;
ssl_ciphers HIGH:MEDIUM;
location / {
proxy_pass http://backend_443;
}
}
server {
listen localhost:8080;
server_name nginx_status.localhost;
location /server-status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
[/code]