server {
	listen 127.0.0.1:80;
	server_name localhost;
	access_log /var/log/nginx/localhost.access_log main;
	error_log /var/log/nginx/localhost.error_log info;
	root /var/www/localhost/htdocs;
	index index.html;

	# Restrict access
	#auth_basic "Restricted";
	#auth_basic_user_file /etc/awstats/htpasswd;


	# Static awstats files: HTML files stored in DOCUMENT_ROOT/awstats/
	location /awstats/classes/ {
		alias /usr/share/awstats/wwwroot/classes/;
	}

	location /awstats/css/ {
		alias /usr/share/awstats/wwwroot/css/;
	}

	location /awstats/icon/ {
		alias /usr/share/awstats/wwwroot/icon/;
	}

	location /awstats-icon/ {
        alias /usr/share/awstats/wwwroot/icon/;
    }

	location /awstats/js/ {
		alias /usr/share/awstats/wwwroot/js/;
	}

	# Dynamic stats.
	location ~ ^/cgi-bin/(awredir|awstats)\.pl {
		gzip off;
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_param SCRIPT_FILENAME /usr/share/awstats/wwwroot/cgi-bin/fcgi.php;
		fastcgi_param X_SCRIPT_FILENAME /usr/share/awstats/wwwroot$fastcgi_script_name;
		fastcgi_param X_SCRIPT_NAME $fastcgi_script_name;
		include fastcgi_params;
	}
}
