
upstream fcgi_backend {
	server 127.0.0.1:9999;
	keepalive 10;
}

server {
	listen 80 default_server;
	listen       443 ssl;
	server_name  _;
	ssl_certificate      /var/lib/mervis/nginx/selfsigned.crt;
	ssl_certificate_key  /var/lib/mervis/nginx/selfsigned.key;
	charset utf-8;


	#access_log  /var/log/host.access.log main;
	access_log off;

	root /www/;

	location / {
		index         index.html index.htm default.aspx Default.aspx;
		#try_files $uri $uri/ /public/index.php$request_uri;
	}

#	location ~ ^/cgi-bin/.*\.x$ {
#		root /usr/share/nginx/cgi-bin;
#		include /etc/nginx/proxy.conf;
#		proxy_pass http://127.0.0.1:8000;
#	}

	location ~ .cgi$ {
		fastcgi_keep_conn on;
		include /etc/nginx/fastcgi.conf;
		fastcgi_param  PATH_INFO          "";
		fastcgi_pass fcgi_backend;
	}

    location /favicon.ico$ {
        alias     /var/lib/misc/favicon.ico;
    }

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	location ~ /\.ht {
		deny  all;
	}

	location = /credentials.cfg {
            	deny all;
	}

    location = /webpanel/hmisettings.xml {
                allow all;
    }

    location /webpanel/img/ {
                allow all;
    }

    location /webpanel/ {
                deny all;
    }

	error_page 400 /errors/error.html?errc=400;
	error_page 401 /errors/error.html?errc=401;
	error_page 402 /errors/error.html?errc=402;
	error_page 403 /errors/error.html?errc=403;
	error_page 404 /errors/error.html?errc=404;
	#error_page 404 /cgi-bin/test.x;
	error_page 405 /errors/error.html?errc=405;
	error_page 406 /errors/error.html?errc=406;
	error_page 407 /errors/error.html?errc=407;
	error_page 408 /errors/error.html?errc=408;
	error_page 409 /errors/error.html?errc=409;
	error_page 410 /errors/error.html?errc=410;
	error_page 500 /errors/error.html?errc=500;
	error_page 501 /errors/error.html?errc=501;
	error_page 502 /errors/error.html?errc=502;
	error_page 503 /errors/error.html?errc=503;
	error_page 504 /errors/error.html?errc=504;
	error_page 505 /errors/error.html?errc=505;
	location /errors {
		ssi on;
		root /usr/share/nginx;
		set $page $request_uri;
		internal;
	}

	location /errimgs {
		root /usr/share/nginx;
	}
}

