#user  nobody;
worker_processes  1;

#[ debug | info | notice | warn | error | crit ]
error_log /nimpix/component/logs/nginx/error.log error;
#access_log  /nimpix/component/logs/nginx/access.log;
pid /nimpix/component/logs/nginx/nginx.pid;

events {
  worker_connections 1024;
}

http {
  include       mime.types;
  default_type  application/octet-stream;

  client_body_temp_path /nimpix/component/temp/nginx/client_body_temp;
  fastcgi_temp_path /nimpix/component/temp/nginx/fastcgi_temp;
  proxy_temp_path  /nimpix/component/temp/nginx/proxy_temp;
  uwsgi_temp_path  /nimpix/component/temp/nginx/wsgi_temp;
  scgi_temp_path /nimpix/component/temp/nginx/scgi_temp;


  include /nimpix/component/vhost/n-sites-enable/*.conf;
  
  sendfile        on;
  keepalive_timeout  65;

  server {
    #
      listen       80;
      server_name  127.0.0.1;
      set  $root_for_cgi "/nimpix/htdocs";
      access_log  /nimpix/component/logs/nginx/host.access.log;
    #
      location / {
        root   /nimpix/htdocs;
        index  index.php index.html index.htm;
      }   
    # Алиас для phpmyadmin
      location /phpmyadmin/ {
        alias /nimpix/component/manager/phpmyadmin/;
        index index.php index.html index.htm;
      }
      location ~ ^/phpmyadmin/(.+\.php)$ {
        alias /nimpix/component/manager/phpmyadmin/$1;
        fastcgi_pass backend;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        include  /nimpix/component/nginx/conf/fastcgi_alias;
      }
    # Алиас для Sypex Dumper
      location /sypex_dumper/ {
        alias /nimpix/component/manager/sypex_dumper/;
        index index.php index.html index.htm;
      }
      location ~ ^/sypex_dumper/(.+\.php)$ {
        alias /nimpix/component/manager/sypex_dumper/$1;
        fastcgi_pass backend;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        include  /nimpix/component/nginx/conf/fastcgi_alias;
      }
    #
      location ~ \.php$ {
        root  /nimpix/htdocs;   
        fastcgi_pass   backend;
        fastcgi_index  index.php;  
        fastcgi_connect_timeout 1;
        fastcgi_next_upstream timeout;
        #fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        include  /nimpix/component/nginx/conf/fastcgi;  
      }
    #
      location ~ /\.ht {
        deny  all;
      }
    #
      location = /stat {
        stub_status on;
        access_log  off;
        allow 127.0.0.1;
        deny all;
    }     
  }
  #
  upstream  backend  {
    server   127.0.0.1:9000;
    server   127.0.0.1:9001;
  }
}