awstats + tomcat + windows

转载链接:http://www.cnblogs.com/fuyuanming/p/5455120.html

awstats + tomcat + windows

下载:

1.apache-tomcat-7.0.67

2.ActivePerl-5.22.1.2201-MSWin32-x86-64int-299574.msi

3.awstats-7.4.zip

修改Tomcat的server.xml:

    
               prefix="localhost_access_log." suffix=".log" pattern="combined" fileDateFormat="yyyy-MM-dd"   
               resolveHosts="false"/>  

 

创建awstats app

1. 在Tomcat的webapp目录下建立文件夹awstats

 awstats + tomcat + windows_第1张图片

在META-INF 下新建context.xml文件



在WEB-INF 下新建 web.xml

复制代码
xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <servlet>
        <servlet-name>cgiservlet-name>
        <servlet-class>org.apache.catalina.servlets.CGIServletservlet-class>
        <init-param>
            <param-name>clientInputTimeoutparam-name>
            <param-value>100param-value>
        init-param>
        <init-param>
            <param-name>debugparam-name>
            <param-value>0param-value>
        init-param>
        <init-param>
            <param-name>cgiPathPrefixparam-name>
            <param-value>WEB-INF/cgi-binparam-value>
        init-param>
        <load-on-startup>5load-on-startup>
    servlet>
    <servlet-mapping>
        <servlet-name>cgiservlet-name>
        <url-pattern>/cgi-bin/*url-pattern>
    servlet-mapping>

    <resource-env-ref>
        <description>
Link to the UserDatabase instance from which we request lists of
defined role names. Typically, this will be connected to the global
user database with a ResourceLink element in server.xml or the context
configuration file for the Manager web application.
        description>
        <resource-env-ref-name>usersresource-env-ref-name>
        <resource-env-ref-type>org.apache.catalina.UserDatabaseresource-env-ref-type>
    resource-env-ref>
    
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>awstats statusweb-resource-name>
            <url-pattern>/cgi-bin/*url-pattern>
        web-resource-collection>
        <auth-constraint>
            <role-name>awstatsrole-name>
        auth-constraint>
    security-constraint>
    
    <login-config>
        <auth-method>BASICauth-method>
        <realm-name>Awstats status,username: awstats,password: awstatsrealm-name>
    login-config>
    
    <security-role>
        <description>
The role that is required to log in to the Manager Application
        description>
        <role-name>awstatsrole-name>
    security-role>

    <welcome-file-list>
        <welcome-file>index.htmlwelcome-file>
        <welcome-file>index.htmwelcome-file>
        <welcome-file>index.jspwelcome-file>
    welcome-file-list>
web-app>
复制代码

复制cgi-bin到WEB-INF目录下

配置 awstats

1. 将 WEB-INF/cgi-bin目录下的awstats.model.conf文件改名为common.conf,新建文件awstats.localhost.conf,内容如下:

复制代码
Include "common.conf"    
LogFile="D:/tool/apache-tomcat-7.0.67/logs/localhost_access_log.%yyyy-%mm-%dd.log"    
SiteDomain="localhost"    
HostAliases="localhost 127.0.0.1"    
DefaultFile="index.jsp"    
#在cgi-bin建立data文件夹     
DirData="data"    
DirCgi="/cgi-bin"    
DirIcons="/awstats/icon"    
#允许在web页更新日志,默认为0(命令行更新)     
AllowToUpdateStatsFromBrowser=1    
复制代码

访问地址http://localhost:8080/awstats/cgi-bin/awstats.pl?config=localhost可以看到awstats的统计界面。点击“立即更新”连接,可以更新统计信息

访问的时候需要 用户配置

在tomcat的conf文件夹中的tomcat-user.xml文件内添加

出现 Cannotrun program perl 的问题,应该在web.xml内必须写全路径

 
cgi 
org.apache.catalina.servlets.CGIServlet 
 
debug
0 
 
 
cgiPathPrefix 
WEB-INF/cgi-bin 




 



executable 
D:/software/Perl/bin/perl 


5 



日志格式错误

tomcat的access-log的设置:http://www.cnblogs.com/xusir/p/4226620.html

你可能感兴趣的:(jee)