
#user  nobody;
worker_processes  1;

#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;

    #loadbalancing PHP
    upstream myLoadBalancer {
         server 127.0.0.1:9001 weight=1 fail_timeout=5;
         server 127.0.0.1:9002 weight=1 fail_timeout=5;
         server 127.0.0.1:9003 weight=1 fail_timeout=5;
         server 127.0.0.1:9004 weight=1 fail_timeout=5;
         least_conn;
     }    
    
    #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  logs/access.log  main;
    access_log   off;
    
    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen          9090;
        server_name     localhost;
     
        index           index.php;
        root            audiostreamer/core;
     
        location / {
            try_files   $uri $uri/ /index.php;
        }
     
        location ~ \.php$ {
            try_files $uri =404;           # This is not needed if you have cgi.fix_pathinfo = 0 in php.ini (you should!)
            #fastcgi_pass   127.0.0.1:9123;
            fastcgi_pass   myLoadBalancer;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;            
        }
    }
}
