Introduction to Awstats in Nginx

Source: Internet
Author: User

1. Generate static html:

The code is as follows: Copy code

/Usr/local/awstats/tools/awstats_buildstaticpages.pl-update-config = www.111cn.net
-Lang = cn-dir =/home/wwwroot/awstats/

Nginx configuration:

The code is as follows: Copy code

Server {
Listen 80;
Server_name awstats. haiyun. me;
Access_log/var/log/nginx/awstats. log main;
Root/home/wwwroot/awstats;
Index index.html;
 
# Restrict access
# Auth_basic "Restricted ";
# Auth_basic_user_file/etc/awstats/htpasswd;
 
Location/css /{
Alias/usr/local/awstats/wwwroot/css /;
  }
 
Location/icon /{
Alias/usr/local/awstats/wwwroot/icon /;
  }
 
Location/js /{
Alias/usr/local/awstats/wwwroot/js /;
  }
}

2. Use fcgi:

The code is as follows: Copy code

Cd/usr/local/awstats/tools/nginx/
Cp awstats-fcgi.php ../wwwroot/cgi-bin/fcgi. php

The code is as follows: Copy code

Server {
Listen 80 default_server;
Server_name _;
 
Access_log/home/wwwlogs/access. log main;
 
Root/home/wwwroot/default;
Index index.htm index.html index. php;
 
Location ~ ^/Cgi-bin/. *. (cgi | pl | py | rb ){
Gzip off;
Root/usr/local/awstats/wwwroot;
Fastcgi_pass unix:/tmp/php-cgi.sock;
Include fastcgi. conf;
Fastcgi_param SCRIPT_FILENAME $ document_root/cgi-bin/fcgi. php;
Fastcgi_param X_SCRIPT_FILENAME $ document_root/$ fastcgi_script_name;
Fastcgi_param X_SCRIPT_NAME $ fastcgi_script_name;
  }
 
Location/icon /{
Alias/usr/local/awstats/wwwroot/icon /;
  }
 
Location/css /{
Alias/usr/local/awstats/wwwroot/css /;
  }
 
Location/js /{
Alias/usr/local/awstats/wwwroot/js /;
  }
 
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.