View Single Post
  #29  
Old 18th November 2010, 20:30
renders renders is offline
Junior Member
 
Join Date: Jan 2008
Location: Ontario Canada
Posts: 25
Thanks: 1
Thanked 6 Times in 4 Posts
Smile

Thought that I would share my conf files in case someone finds this helpful.

** I am continuing to tweak and as such, some of these settings may not be appropriate for everyone. **

nginx.conf

Code:
user www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  2048;
    use epoll;
}

http {
    
    root  /var/www/;
    error_page   502 503 504  /50x.html;
    
    server_names_hash_max_size 512;
    server_names_hash_bucket_size 128;
    
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    

    
    client_header_timeout   10m;
    client_body_timeout     10m;
    send_timeout            10m;
    connection_pool_size           512;
    client_header_buffer_size       1k;
    large_client_header_buffers     4 2k;
    request_pool_size               4k;
    client_body_temp_path /var/lib/nginx/body 1 2;  
    
    gzip  on;
    gzip_http_version 1.0;
    gzip_min_length  5000;
    gzip_types text/plain text/css image/x-icon application/x-javascript application/javascript text/javascript application/atom+xml application/xml;
    gzip_buffers 4 8k;    
    gzip_vary         on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    gzip_proxied  any;
    gzip_comp_level 2;

    output_buffers  1 32k;
    postpone_output 1460;
    sendfile        on;
    #tcp_nopush     on;
    keepalive_timeout       75 20;
    tcp_nodelay        on;
    ignore_invalid_headers  on;
    index index.html;
    
    server_tokens off;

    access_log	  /var/log/nginx/access.log;
    error_log     /var/log/nginx/error_log;

    #default nginx virtual host server
    #it's used if there is no other matching nginx virtual host found
    server {      
	listen 80;      
	#you can access nginx internal stats using lynx or alike console based web browser or munin-node    
	#at http://127.0.0.1/nginx_status address
	location /nginx_status {
	    stub_status on;
	    access_log   off;
	    allow 127.0.0.1;
	    deny all;
	}
	
        #default proxy settings for each virtual host
        include /etc/nginx/proxy.conf;
    }
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}
proxy.conf

Code:
location / {
   proxy_pass         http://127.0.0.1:82/;
   proxy_redirect     default;
   proxy_set_header   Host             $host;
   proxy_set_header   X-Real-IP        $remote_addr;
   proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
   client_max_body_size       64m;
   client_body_buffer_size    128k;
   proxy_connect_timeout      90;
   proxy_send_timeout         90;
   proxy_read_timeout         90;
   proxy_buffer_size          4k;
   proxy_buffers              4 32k;
   proxy_busy_buffers_size    64k;
   proxy_temp_file_write_size 64k;
}
proxy_fallback.conf

Code:
#proxy options can't be set inside if directive 
proxy_set_header   Host             $host;
proxy_set_header   X-Real-IP        $remote_addr;
proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
 if (!-f $request_filename) {
 break;
 proxy_pass http://127.0.0.1:82;
}
Virtual conf file, each virtual host needs one of these otherwise nginx just passes the entire request thru to Apache.

Code:
server {
   listen 80;
   server_name VIRTUAL1.com www.VIRTUAL1.com;
   #default proxy settings shared are among all virtual hosts
   include /etc/nginx/proxy.conf;
      location ~* ^.+.(jpe?g|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|html?|txt|tar|mid|midi|wav|bmp|rtf|js|swf|avi|mp3)$ {
           #forcing browser to cache locally static content for 1 day, set this longer as needed.
           expires 1d;
           root /var/www/VIRTUAL1.com/web/;
           access_log  /var/log/ispconfig/httpd/VIRTUAL1.com/access.log;
        
           #graceful fallback in case if static content doesn't exist
           include /etc/nginx/proxy_fallback.conf;
      }
}

Last edited by renders; 18th November 2010 at 20:33. Reason: typos
Reply With Quote