2007年12月6日星期四

Windows XP 下安装整合Apache2+Mysql5+Tomcat5.5+PHP5+JSP+ASP


Windows XP 下安装整合Apache2+Mysql5+Tomcat5.5+PHP5+JSP+ASP
软件:
Apache(2.2.4):http://httpd.apache.org/download.cgi
PHP(5.2.3,zip包):http://www.php.net/downloads.php
MySQL(5.0.41):http://dev.mysql.com/downloads/
phpMyAdmin(2.10.2):http://www.phpmyadmin.net/home_page/downloads.php
Tomcat5.5 http://tomcat.apache.org/...


1. 安装PHP5,路径可以自己调整,记得在用到路径时使用自己设置的路径就没问题。
直接解压压缩包到c:\php
更改环境变量:我的电脑属性》高级》环境变量》双击"Path",追加c:\php;c:\php\ext


2.安装Apache2.2
双击msi安装包,domain和server可以用自己本地的ip或者localhost


配置Apache
用记事本打开%apache-root%/conf/httpd.conf,找到:
# LoadModule foo_module modules/mod_foo.so
追加:
LoadFile "c:/php/php5ts.dll"
LoadFile "c:/php/libmysql.dll"
PHPIniDir "c:/php"
LoadModule php5_module "c:/php/php5apache2_2.dll"


找到:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
追加:
AddType application/x-httpd-php .php
这样就可以支持php5和mysql


接下来更改网站目录:
DocumentRoot "c:/wwwroot"
更改为你的apache的web根目录,我的是D:/develop/apache2/htdocs
<Directory "D:/develop/apache2/htdocs">


更改默认页面:
DirectoryIndex index.html index.php (这里可以追加一堆你想要的,什么defult.hml,index.jsp...etc)


暂时没什么可以更改的了,稍后整合还要修改。


php的配置


把php.ini-dist复制一份,改名为 php.ini然后修改:


在Data Handling下找到post_max_size = 8M
这是PHP将接受的POST数据最大大小,可更改为20M。


在Paths and Directories下找到extension_dir=
这里设置的是PHP搜索扩展库的位置,将其路径设为extensions文件夹的位置,即改成:
extension_dir="c:\php\ext"


在File Uploads下找到upload_max_filesize = 2M,允许上传的的最大文件大小
可更改为20M。


Dynamic Extensions这里是PHP扩展设置部分,列出了PHP所有的可支持扩展,前面都加了分号注释,表示目前PHP配置不支持扩展,我们可以将分号去掉让PHP支持该扩展下面列出的是几个常用且较实用的PHP扩展把下面几句前面的分号去掉
;extension=php_mbstring.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_filepro.dll
;extension=php_gd2.dll
;extension=php_imap.dll
;extension=php_mysql.dll


好了一切准备就绪!
修改好之后COPY php.ini一份到C:\Windows下


3.重起APACHE,在主目录下新建一个记事本文件test在里面输入
<?php
phpinfo();
?>
保存后修改后缀名为PHP。在浏览器输入http://127.0.0.1/test.php是不是看到PHP版本信息,没错,这样PHP的配置就完成了。



4. 安装MYSQL5。
第一步:双击.exe文件出现的第一个需要选择的对话框是Setup Type 也就是
安装种类,这里我们可以选择Custom,根据自己的需要来安装组件和配置安装路径
点击Next,右键点击对话框出现几个硬盘形状的图标,根据自己的需要选择安装组件,
点击窗口右下的Change按钮更改安装路径的,设置好后,点击Next开始安装安装到最
后会有如下一个对话框在这里的三个选项分别是:
1:如果你没有MYSQL.com帐户,选第一个,创造一个新的免费的MYSQL.com帐户
2:如果你有MYSQL.com帐户,选第二个,填入已经注册好的邮箱名和密码(最好跳过,懒得麻烦,又没什么大用处)
3:跳过此步骤
我们选第一个


接下来会一次出现三个对话框,在三个对话框中有* 号的部分是必须要填的,
按顺序分别是邮箱名,密码,确认密码;first name ,last name;邮政编码,
国家,省名。国家名选china,省名选other or N/A即可4.1.x和4.0.x系列版
本很大一个区别就是在安装完毕后不是运行 mysql文件夹下面的winmysqladmin.exe来
启动服务器后设置选项,而是有一个设置的过程。


第二步:设置MYSQL


首先你会看到这样的一个窗口,这里有两个选项,分别是详细配置和标准配置,
小型应用选第二项就可以了点击Next后出现下面的对话框,这里是重要的,一定
要在下拉菜单里选择MySQL41,否则不能正常启动,下面的选项是是否应用命令行,
最好选上点击Next后设置数据库密码的对话框,中间偏右和下面的选项分别是是否
允许远程控制和是否允许匿名帐号登入,为了安全,不要选择好了,点击Next后出
现最后的对话框,点击Execute按钮数据库服务器便启动了,依次出现四个对号后
点击Finish结束安装


5.装上PHPMYADMIN
安装很简单,解压缩即可,放在...yourapacheinstallationpath/htdocs/下,通过web访问,http://localhost/phpmyadmin/
如果遇到如下提示,do not worry.
#1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client
在开始菜单找到刚刚安装的MYSQL命令行工具,输入root的密码后键入如下的字样:
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('刚才设置的ROOT密码')
-> WHERE Host = 'localhost' AND User = 'root';
mysql> FLUSH PRIVILEGES;(注意FLUSH后有空格)
然后浏览"http://localhost/phpmyadmin"
OH YEAH! 测试成功!


6。安装Tomcat5.5
好了,以上安装好了Apache2+PHP5+Mysql5.下面接着要安装Tomcat5来支持JSP啦。
tomcat需要JAVA支持,所以要先安装JDK1.5,(JDK1.6太新了,最好不要用,不过你可以尝试,呵呵),从SUN网站上下载安装即可,要把路径写入环境变量
这个就不要我说了吧。稍微用过Java的地球人的知道,大家都是从"Hello World!"过来的。
从apache2上下载tomcat5.5的windows安装文件,文件名为"apache-tomcat-5.5.20.exe" ,一路安装,应该没什么问题。
默认端口是8080,不必修改。安装好之后启动tomcat5,在browser下访问http://localhost:8080
我猜你一定看到熟悉的tomcat界面了。


7。整合apache2+tomcat5
不要采用传统的JK模块进行整合了,用apache2自带的模块很不错的
因为apache2.2.4采用mod_proxy连接apache与tomcat,所以配置非常简单。
这里我们只需要改动...yourpath\Apache2.2\conf\ 下的httpd.conf的两个地方即可:
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
去掉"#"
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
然后加上如下两行,意思是将apache2/htdocs/下的所有文件转发给JSP处理
ProxyPass / ajp://127.0.0.1:8009/
ProxyPassReverse / ajp://127.0.0.1:8009/
或许这并不是你想要的。如果你的WEB服务主要用来出来JSP,那么当然你可以这样,加入如下这句
ProxyPass /img ! img是htdocs下的目录名,你可以修改为你自己的
意思img目录下的文件不转发给tomcat处理,由apache+php自己处理。
另外,还要修改tomcat的server.xml配置文件,使tomcat端口和根目录指向htdocs.有多种方法修改指向,一是在server.xml中写明
而是配置conf\Catalina\localhost\下的ROOT,文件,在这里我修改ROOT文件为:
<?xml version='1.0' encoding='utf-8'?>
<Context path="" reloadable="ture" docBase="D:\Develop\Apache2.2\htdocs\jsp\" >
</Context>

为了方便大家,我也贴出我的server.xml文件。


<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="7443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<Connector port="8443" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="conf/tomcat.keystore" keystorePass="pea4ch"/>
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>
</Server>

我做得比较整洁。并且有使用SSL配https,
<Connector port="8443" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="conf/tomcat.keystore" keystorePass="pea4ch"/>
这段是可以忽略的。
---------------------××××××××××××××××××××××××××××××××----------------------------

我自己是这样的。因为我使用了apache2的虚拟主机,
两个虚拟主机
www.zhuheng.com 的根目录在 D:\Develop\Apache2.2\htdocs
www.zhuheng.org 的根目录在 G:\WWW 下
我的JSP文件放在D:\Develop\Apache2.2\htdocs\jsp下。
于是我在httpd-vhosts文件中这样设置:
#henry added @2007-11-26 for virtual hosts test
<VirtualHost *:80>
ServerName www.zhuheng.com
DocumentRoot "D:/Develop/Apache2.2/htdocs"
ProxyPass /jsp/ ajp://localhost:8009/
ProxyPassReverse /jsp/ ajp://localhost:8009/
</VirtualHost>
<VirtualHost *:80>
ServerName www.zhuheng.org
DocumentRoot "H:/www"
</VirtualHost>

-------------
解释:
ProxyPass /jsp/ ajp://localhost:8009/
ProxyPassReverse /jsp/ ajp://localhost:8009/
这两句的意思是把D:\Develop\Apache2.2\htdocs\jsp的文件交给tomcat解析。成功啦!


当然之前要修改httpd.conf,打开load proxy mod的功能:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

就是这样啦。也还蛮简单的。


8。整合ASP
也是用apache下面的一个模块,叫mod_aspdotnet 2.0.0
我的安装过程如下:
下载安装windows asp.net framework2.0
URL:http://www.microsoft.com/downloa ... &DisplayLang=en,选择网络类型下载
默认安装即可,缺省安装路径是:C:\WINDOWS\Microsoft.NET
http://sourceforge.net/project/d ... r2.msi&50319130
下载apache2支持ASP的模块mod_aspdotnet 2.0.0
默认安装在apache2的路径下。
安装完成之后,修改httpd.conf
在httpd.conf最后追加如下内容:
#asp.net
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo
<IfModule mod_aspdotnet.cpp>
# Mount the ASP.NET example application
AspNetMount /active/ "D:/ASP"
# Map all requests for /active to the application files
Alias /active "D:/ASP"
# Allow asp.net scripts to be executed in the active example
<Directory "D:/ASP">
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex Default.htm Default.aspx
</Directory>
# For all virtual ASP.NET webs, we need the aspnet_client files
# to serve the client-side helper scripts.
AliasMatch /aspnet_client/system_web/(d+)_(d+)_(d+)_(d+)/(.*) "C:/Windows/Microsoft.NET/Framework/v1.1.4322/ASP.NETClientFiles/$4"
<Directory "C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/ASP.NETClientFiles">
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
</IfModule>


-------×××××××××××××××××××××××××-------------------------
因为我使用了虚拟主机,所以我又在httpd-vhost.conf文件中添加了如下内容:
<VirtualHost *:80>
ServerName www.zhuheng.com
DocumentRoot "D:/Develop/Apache2.2/htdocs"
ProxyPass /jsp/ ajp://localhost:8009/
ProxyPassReverse /jsp/ ajp://localhost:8009/
<IfModule mod_aspdotnet.cpp>
AspNetMount /active/ "D:/ASP"
Alias /active "D:/ASP"
<Directory "D:/ASP">
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex Default.htm Default.aspx index.htm index.html
</Directory>
<Directory "C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/ASP.NETClientFiles">
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
</IfModule>
</VirtualHost>

-------×××××××××××××××××××××××××-------------------------
解释:
在apache2/htdocs下建一个active的空目录,然后通过【AspNetMount /active/ "D:/ASP"】指向到ASP的工作路径,
当然你可以修改为你自己的。active也是可以自己随意命名的,只是起一个转向作用。


写到这里基本上几完成了,在整合过程中,你需要不断重启apache,用"net stop|start apache2"命令,你也可以不断在控制台中使用"apache2\bin\httpd.exe -S" 这个命令,检查你的的httpd.conf配置文件
是否有错误。它会给你很好的提示。最后我贴出我的httpd.conf,httpd-vhosts.conf,server.xml,ROOT.xml ,希望对你有帮助。更多详情,请访问我的个人网站http://www.2008kid.cn:8888
httpd.conf
###########below is my httpd.conf##############


ThreadsPerChild 250
MaxRequestsPerChild 0
ServerRoot "D:/Develop/Apache2.2"
Listen 80
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule php5_module "D:\Develop\PHP5\php5apache2_2.dll"
PHPIniDir "D:\Develop\PHP5\"
LoadFile "D:\Develop\PHP5\libmysql.dll"
LoadFile "D:\Develop\PHP5\libmcrypt.dll"
LoadFile "D:\Develop\PHP5\php5ts.dll"
ServerAdmin zh1229@gmail.com
ServerName www.zhuheng.com:80
DocumentRoot "D:/Develop/Apache2.2/htdocs"
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
Satisfy all
</Directory>
<Directory "D:/Develop/Apache2.2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php index.jsp default.jsp default.php default.aspx
</IfModule>
#2007-11-26 henry 整合apache2.2.4和tomcat5.5 ,不用jk2模块
#<IfModule mod_proxy.c>
#ProxyRequests On
#ProxyVia On
#<Proxy /*>  
#Order deny,allow
#Deny from all
#Allow from localhost
#</Proxy>
#ProxyPass /img ! 
#ProxyPass / http://localhost:8009/
#ProxyPassReverse / http://localhost:8009/
#</IfModule>


<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>
ErrorLog logs/error.log
LogLevel warn


<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog logs/access.log common
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "D:/Develop/Apache2.2/cgi-bin/"
</IfModule>
<Directory "D:/Develop/Apache2.2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
DefaultType text/plain


<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
Handler cgi-script .cgi
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm
</IfModule>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>


#asp.net
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo
<IfModule mod_aspdotnet.cpp>
Mount the ASP.NET example application
AspNetMount /active/ "D:/ASP"
Alias /active "D:/ASP"
<Directory "D:/ASP">
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex Default.htm Default.aspx
</Directory>
AliasMatch /aspnet_client/system_web/(d+)_(d+)_(d+)_(d+)/(.*) "C:/Windows/Microsoft.NET/Framework/v1.1.4322/ASP.NETClientFiles/$4"
<Directory "C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/ASP.NETClientFiles">
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
</IfModule>


2.httpd-vhosts.conf
################below is my httpd-vhosts.con#################
<VirtualHost *:80>
ServerName www.zhuheng.com
DocumentRoot "D:/Develop/Apache2.2/htdocs"
ProxyPass /jsp/ ajp://localhost:8009/
ProxyPassReverse /jsp/ ajp://localhost:8009/
<IfModule mod_aspdotnet.cpp>
AspNetMount /active/ "D:/ASP"
Alias /active "D:/ASP"
<Directory "D:/ASP">
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex Default.htm Default.aspx index.htm index.html
</Directory>
<Directory "C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/ASP.NETClientFiles">
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
</IfModule>
</VirtualHost>
<VirtualHost *:80>
ServerName www.zhuheng.org
DocumentRoot "H:/www"
</VirtualHost>


server.xml & ROOT.xml文件已经贴过了


That's ALL. Good Luck to you. more information, please browse my personal website, http://www.2008kid.cn:8888.


2007年11月2日星期五

200-10-19

2007-10-19,重阳节,我和妹妹在沱江维多利亚大酒店办酒啦

2007年9月9日星期日

2007-9-10-教师节

今天是2007年的教师节,祝妹妹老婆节日快乐,天天都快乐!@@@
Your sincere,
------------
Henry Zhu
2007-09-10

2007年8月28日星期二

2007-08-21 (永远的纪念日)

今天是我和妹妹领结婚证的日子,是我们永远的纪念日!
            @@@我将永远爱我的妹妹@@@@
 
朱恒
2007-08-21

2007年6月27日星期三

XP 下安装Apache2.2.4+PHP5.2.4+Mysql5


首先准备好软件:(截至今天,全都是最新的稳定版本)
PHP 5.2.3 http://www.php.net
Apahce 2.2.4 http://httpd.apache.org
Mysql 5.1.19 http://dev.mysql.com/downloads/mysql/5.1.html


安装php5
直接解压压缩包到c:\php
更改环境变量:我的电脑属性》高级》环境变量》双击"Path",追加c:\php;c:\php\ext


安装Apache
双击msi安装包,domain和server可以用自己本地的ip或者localhost


配置Apache
用记事本打开%apache-root%/conf/httpd.conf,找到:
# LoadModule foo_module modules/mod_foo.so
追加:
LoadFile "c:/php/php5ts.dll"
LoadFile "c:/php/libmysql.dll"
PHPIniDir "c:/php"
LoadModule php5_module "c:/php/php5apache2_2.dll"


找到:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
追加:
AddType application/x-httpd-php .php
这样就可以支持php5和mysql


接下来更改网站目录:
DocumentRoot "c:/wwwroot"
还有这个别忘记,不然会出现403禁止访问的错误:
<Directory "c:/wwwroot">


更改默认页面:
DirectoryIndex index.html index.php


好了其他没什么可以更改的。


php的配置


把php.ini-dist复制一份,改名为 php.ini然后修改:


在Data Handling下找到post_max_size = 8M
这是PHP将接受的POST数据最大大小,可更改为20M。


在Paths and Directories下找到extension_dir=
这里设置的是PHP搜索扩展库的位置,将其路径设为extensions文件夹的位置,即改成:
extension_dir="c:\php\ext"


在File Uploads下找到upload_max_filesize = 2M,允许上传的的最大文件大小
可更改为20M。


Dynamic Extensions这里是PHP扩展设置部分,列出了PHP所有的可支持扩展,前面都加了分号注释,表示目前PHP配置不支持扩展,我们可以将分号去掉让PHP支持该扩展下面列出的是几个常用且较实用的PHP扩展把下面几句前面的分号去掉
;extension=php_mbstring.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_filepro.dll
;extension=php_gd2.dll
;extension=php_imap.dll
;extension=php_mysql.dll


好了一切准备就绪!


重起APACHE,在主目录下新建一个记事本文件test在里面输入
<?php
phpinfo();
?>
保存后修改后缀名为PHP。在浏览器输入http://127.0.0.1/test.php是不是看到PHP版本信息,没错,这样PHP的配置就完成了。接下来安装MYSQL。


第一步:双击.exe文件出现的第一个需要选择的对话框是Setup Type 也就是
安装种类,这里我们可以选择Custom,根据自己的需要来安装组件和配置安装路径


点击Next,右键点击对话框出现几个硬盘形状的图标,根据自己的需要选择安装组件,


点击窗口右下的Change按钮更改安装路径的,设置好后,点击Next开始安装安装到最
后会有如下一个对话框在这里的三个选项分别是:


1:如果你没有MYSQL.com帐户,选第一个,创造一个新的免费的MYSQL.com帐户


2:如果你有MYSQL.com帐户,选第二个,填入已经注册好的邮箱名和密码


3:跳过此步骤


我们选第一个


接下来会一次出现三个对话框,在三个对话框中有* 号的部分是必须要填的,
按顺序分别是邮箱名,密码,确认密码;first name ,last name;邮政编码,
国家,省名。国家名选china,省名选other or N/A即可4.1.x和4.0.x系列版
本很大一个区别就是在安装完毕后不是运行 mysql文件夹下面的winmysqladmin.exe来
启动服务器后设置选项,而是有一个设置的过程。


第二步:设置MYSQL


首先你会看到这样的一个窗口,这里有两个选项,分别是详细配置和标准配置,
小型应用选第二项就可以了点击Next后出现下面的对话框,这里是重要的,一定
要在下拉菜单里选择MySQL41,否则不能正常启动,下面的选项是是否应用命令行,
最好选上点击Next后设置数据库密码的对话框,中间偏右和下面的选项分别是是否
允许远程控制和是否允许匿名帐号登入,为了安全,不要选择好了,点击Next后出
现最后的对话框,点击Execute按钮数据库服务器便启动了,依次出现四个对号后
点击Finish结束安装


装上PHPMYADMIN后测试连接,若出现
#1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client
在开始菜单找到刚刚安装的MYSQL命令行工具,输入root的密码后键入如下的字样:
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('刚才设置的ROOT密码')
-> WHERE Host = 'localhost' AND User = 'root';

mysql> FLUSH PRIVILEGES;(注意FLUSH后有空格)
然后浏览"http://localhost/phpmyadmin",OH YEAH! 测试成功!


在谈一下关于MYSQL 4.1以后由于采用UTF8导致的乱码问题解决办法。首先注意一点,在新建数据库的时候字符集一定要选择UTF8,在PHPMYADMIN中新建数据库下,创建按钮的左边,有个下拉列表,默认是"整理",选择UTF8。你会发现表里数据不在是问号了。
但是网页的输出还是问号,不要急接着在PHP语句中要有所改动:
在mysql_connect(…连接参数);后加上mysql_query("SET NAMES 'GBK'");
但是如果网页很多,这样不是很麻烦,所以我在编写PHP时将所有数据库的操作写成一个类如:
class db{
….包含一些数据库调用方法….
//创建数据库连接并选择相应数据库
function createcon(){
mysql_connect(…);mysql_query("SET NAMES 'GBK'");
}
}
完毕!


Your sincere,



------------



Henry Zhu



2007-06-28




2007年6月26日星期二

how to use scp without password

how to use scp without password:
1) run this command to generate public key ssh-keygen -t rsa In response you'll see: "Generating public/private rsa key pair" "Enter file in which to save the key ... " Just hit enter to accept this. In response you'll see: "Enter passphrase (empty for no passphrase):" You don't need a passphrase, so just hit enter twice. In response you'll see: "Your identification has been saved in ... " "Your public key has been saved in ... " Note the name and location of the public key just generated (it will always end in .pub).
2) Copy the public key just generated to any server:/root/.ssh/authorized_keys
3) now you run "sudo scp filename user@serverName:/path/" Wow !!! It copied with no password!!

 

 

Note:须在本机上面生成钥匙对,然后把公匙发送到远程计算机,这样使用SCP的时候就不用输入远程计算机的密码了.

Step by step:

1.            ssh-keygen �t rsa

2.            Hit 'enter'

 

可以追加多个公匙:

[root@web07p .ssh]# ls -l

total 12

-rw-r--r--    1 root     root          220 Jan  8 01:25 250authorized_keys

-rw-r--r--    1 root     root          220 Jan  8 01:24 authorized_keys

-rw-r--r--    1 root     root         2906 Dec 27 18:35 known_hosts

[root@web07p .ssh]# ls

25023.pub  250authorized_keys  authorized_keys  known_hosts

[root@web07p .ssh]# cat authorized_keys

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAtupCHjuGftXqAUmIWNs4Dq9Tww8sGni5mA19XeUnZ2QOionV2owpGHvYbTUc/+jwgMVyzBBZXXv0m1mI+Kl0nLV9kWg1VqnF+5X7OqCoykNxXZPAVdaTO7xAqC/nmiAgmqK8vhVsOk2aM96s8b7a40Deex/Q7+yE8qrNXX9+FCE= root@db03p

[root@web07p .ssh]# cat 25023.pub >>authorized_keys

[root@web07p .ssh]# cat authorized_keys

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAtupCHjuGftXqAUmIWNs4Dq9Tww8sGni5mA19XeUnZ2QOionV2owpGHvYbTUc/+jwgMVyzBBZXXv0m1mI+Kl0nLV9kWg1VqnF+5X7OqCoykNxXZPAVdaTO7xAqC/nmiAgmqK8vhVsOk2aM96s8b7a40Deex/Q7+yE8qrNXX9+FCE= root@db03p

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAuiWname5RnDVRbyRg2mouwqTJs6TRF82GCf5k3GblxYYXq7WTp3MRN+v1dI9IAHUKM3bGSXAnIIHsJ04ZSBz+jvdTLfn8eE7K9ebZvfGWRNLwZMay2C3MUaa7DCpqnamMGy1nIw9w1ir/gfsQk/wxy7REqoHiU9hShGp0Qac/h8= root@web08

[root@web07p .ssh]#

Your sincere,
------------
Henry Zhu
2007-06-27

2007年6月24日星期日

linux下光盘镜像文件的制作与挂载

近日突发奇想试着在linux下用dd命令制作光盘镜像,试验成功,在此与诸位分享经验。

原本我只知道在linux终端中可以用"mount /mnt/disk.iso /mnt/temp -t iso9660 -o loop"命令直
接挂载iso镜像文件(这里假设iso文件为/mnt/disk.iso;挂载点为/mnt/temp),然后在/mnt/temp中就能浏览镜像内容
了。而最近受用dd命令复制磁盘引导区的启发,用" dd of=/mnt/disk.iso if=/dev/hdc"成功地制作了iso镜像文件
(这里假设光盘为/mnt/hdc;并事先新建/mnt/disk.iso文件)。

dd命令原本用于复制文件,但由于linux特殊的文件系统结构--它将所有的硬件设备均作为树状目录下的一个文件(一般位于/dev目录下),dd命
令正好可以把光盘设备中的全部信息原样复制到一个文件中,而这正是iso文件的原理。

至于dd命令的其他参数参见"man dd"。

2007年6月18日星期一

喜欢IDEA的25个理由

喜欢使用IntelliJ Idea的25个理由

IntelliJ Idea是一个相对较新的Java IDE。它是我所使用过的(我用过大部分Java开发环境)Java开发环境中最为有用的一个。高度优化的IntelleJIdea使普通任务变得相当容易。

通常不是较大的标签特性使一个产品真正有用。而是这些小的方面:里面的许多小的细节使整个包无缝集成及乐于使用。

下面是我真正喜爱Idea的一些理由。


1、感知语法词选择

反复使用Ctrl-w使所选表达式逐步增大直到选取整个文件。但是这一点听起来并不是很重要,它在与其它特性如"introduce variable"refactoring("引入变量"重整)相结合使用时才真正好用。我可以把脱字符置于复杂表达式上,按Ctrl-w直到选取所需范围然后按Ctrl-Alt-v为表达式引入一个新的变量。如果我要替换这个表达式的其他事件Idea甚至也可以自动做到。

2、多种导航形式

在一个工程里,Idea有很多种方法用于转换。除鼠标之外所有的命令都可以通过键盘实现(这一点对于像我这样难以忍受不停地切换到鼠标的人来说绝对不错)。Ctrl-n可以通过键入类名查找一个类。Ctrl-shift-n可以查找文件。Ctrl-e得到最近编辑的文件,通过键入文件名或者鼠标键选择。命令不仅可以容易地在你的工程两个视图里导航并且使整合操作变得轻而易举。Alt-f1可以是你在任何一个其他视图里选择当前文件。工程导航地方法太多在这儿不能全部列举。所有命令没必要像观点一样都给出概念。

3、 本地历史

开启本地历史,你源代码中的每一个改变(在tool和externally里)都被跟踪。这个特性救了我很多次所以我推荐它。不同的地方在一个绝对漂亮的差异查看器里高亮显示出来。

4、灵活的JUnit支持

单元测试可以独立运行。特殊的测试方法可以单独拉出来独立运行。Idea能够在一个包或者工程里自动运行所有测试而不需要手工启动一个麻烦的测试套件。在GUI运行器里的堆迹线上双击可以直接切换到源代码的相应行。就我个人认为我更喜欢文本运行器。它不但秀美而且速度更快功能更多。

5、设计优良的整合支持

Idea支持很多整合功能。更重要的使它们设计的好容易使用。有一些你会一直使用,也有一些几乎用不到。当你发现你需要他们时它们就成了一个大的时间节约器。

6、 代码助手

在Idea里有一些真正强大的代码编写助手。在这里我只能介绍给你一点它的好处。一个比较好的例子是"委托方法"助手。它允许你在你的类里面为一个对象实例委托方法调用。它并不是你每天都使用的东西,但当你需要它的时候你就会发现自己节省了大量的时间。另一个例子是产生冗余代码和等价特性。你会发现这是一个自己经常使用的特性。其他一些代码助手特性为:产生Getters/Setters,产生构造器与"surround with…"(译者注:被什么保护)等特性。

7、灵活的代码重格式化

关于代码怎样重格式化的选择有许多。它可以为每一个工程单独设置,所以没必要担心自己是否必须支持不同的代码标准。重格式化一个文件或者一个完整的工程眨眼间就可以完成。

8、 XML支持

Idea支持XML中的代码实现。如果没有定义图表或者DTD(文件类型定义)Idea将基于文件中已经包含的来实现。否则可能基于为文件定义的图表或者DTD来实现。Idea同时还会校正XML。

9、 直观简洁的GUI

更为好玩的是每一个程序中的函数都可以通过键盘访问的到。在一个开发工具里这是应该有的但可悲的是大多数IDE对键盘导航并不注意。

为了完成工作不必要在不同的视图之间切换,也不必要在不同的窗口之间选择了。

10、与文件系统自动同步

不管你的IDE是多么优秀,通常都需要在工具之外作一些工作。Idea在这一点上做的很好。大多数工程都可以在Idea里不用改变他们的结构就可以使用。Idea还可以检查文件在外部的更改情况。这不需要人工刷新以告诉Idea一个文件已被更改。

11、定制的键盘映射

Idea自带的默认键盘映射非常有用。如果有时需要改变也很容易做到。有些键也可以设置阻挡比如外来的工具与Ant目标等。

12、 动态的错误高亮显示

在键码时Java代码,XML与Java文档标签被动态解析,错误也会被报告。Ant建立文件甚至可为Ant工程句法提供额外支持。

13、 检查

运行代码检查以报告大量的代码中潜在的错误点。它可以编制成脚本以作为一个批量工作运行,结果也可以以网页的形式提交。

14、 完全理解JSP

Idea理解JSP的结构。作用于普通Java代码的众多功能同样适用于JSP(比如整合功能)。同时支持JSP调试。

15、灵巧的编辑功能

一些小技巧如键入匹配的引号及括号使得生活更加容易:)。

16、 支持EJB

Idea理解EJB,尽管它不包括对个别应用服务器的特殊支持。不管怎样最好与Ant一起使用。EJB支持容易使用而且实在-本来就是这样。
17、几乎没有向导

从前许多厂家都绑定大量的向导而不是设计一个简单易用的接口。虽然有向导但只是一个滥用的工具。Idea只包含了一个用于帮助创建新工程的向导,并且仍然能够创建一个对新手来讲容易使用的程序。

18、灵巧的模板

这些灵巧的模板是代码的片断,它们被用来做各种各样令人惊讶的事情。我第一次使用"iterate over collection"模板时就被震惊了。它不仅挑拣出正确的默认收集变量而且还知道我已经放进去了什么以及默认的方法。这个特性很难在纸上描述。下载一个测试版本试验一下吧。

19、最好的代码实现支持

Idea现在有三种代码实现支持包括实现默认得变量名称,JavaDoc以及其他代码细节。

20、集成Ant

Idea支持Ant建立工具。不仅是运行目标它还支持编译与运行程序前后运行目标,另外也支持绑定键盘快捷键。

在编辑一个Ant建立XML文件时,Idea还对组成Ant工程的XML部分提供支持。

21、未使用代码高亮显示

如果Idea检查出某一个变量或者方法没有被使用,它会把它作为一个不明显的警告显示出来。检查可用来做更详细的死代码分析。甚至JavaDoc标签也能被查出来。

22、小技巧

Ctrl-d复制选中的代码。如果没有选择则复制整行。在没有选择的情况下Ctrl-c拷贝一整行,Ctrl-x剪切一整行。

Ctrl-Shift-j会做一个想VI那样的连接,除非它是句法敏感的。比如有这么一行:

String s = "This is " +

" a split string";

连接之后成为:

String s = "This is a split string";



23、有规律的查找与替换表现



规律查找是可能的,但更美妙的事实是你也可以做规律替换。这一点可节约大量的时间。

24、快速JavaDoc

JavaDoc对任何一个标识符来说都可以通过Ctrl-q轻易地查看到。在编码实现期也可以访问。

25、意识动作

在Idea觉察到它可以通过某种方法帮助你时它会提供一些有用地选择。例如你要使用一个表达式使它可以与指定地变量相匹配,Idea会察觉到这一点然后给你一些选择,要么使用表达式要么改变你在使用地变量地类型。

2007年6月14日星期四

openSSH 升级笔记

tar xvzf openssh-3.9p1.tar.gz
cd openssh-3.9p1
./configure --prefix=/usr --with-pam --with-md5-passwords --sysconfdir=/etc/ssh
make
make install

正常情况已经升级完了,service sshd restart正常
ssh -V 已经显示新的版本
Your sincere,
------------
Henry Zhu
2007-06-15

2007年6月10日星期日

Linux vsftp 限制宿主目录


修改配置文件/etc/vsftpd/vsftpd.conf


chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/unchroot_list


在 /etc/vsftpd/unchroot_list中输入只能访问宿主目录的ftp用户。重启vsftp服务生效。


2007年5月30日星期三

Linux 用perl替换文件内容

perl -pi -e 's|192.168.252.83|12.184.171.150|g' `find ./ -type f`
perl -pi -e 's|192.168.252.83|cvs.verican.info|g' `find . -name Root`
Your sincere,
------------
KsharP
2007-05-30

2007年5月23日星期三

Install Awstats6.6 On Linux[centOS4.4]

AWStats Installation, Configuration and Reporting

There are 3 steps to begin using AWStats:

I. Setup: Installation and configuration

II. Process logs: Building/updating statistics database

III. Run Reports: Building and reading reports

 

 

I. Setup: Installation and configuration using awstats_configure.pl

A) Setup for an Apache or compatible web server (on Unix/Linux, Windows, MacOS...)

* Step 1:

(if you use a package provided with a Linux distribution or Windows installer, step 1 might have already been done; if you don't know, you can run this step again)

After downloading and extracting the AWStats package, you should run the awstats_configure.pl script to do several setup actions. You will find it in the AWStats tools directory (If using the Windows installer, the script is automatically launched):

perl awstats_configure.pl 

 

This is what the script does/asks (you can do all these steps manually instead of running awstats_configure.pl if you prefer):

A) awstats_configure.pl tries to determine your current log format from your Apache web server configuration file httpd.conf (it asks for the path if not found). If you use a common log, awstats_configure.pl will suggest changing it to the NCSA combined/XLF/ELF format (you can use your own custom log format but this predefined log format is often the best choice and makes setup easier).

If you answer yes, awstats_configure.pl will modify your httpd.conf, changing the following directive:

from

CustomLog /yourlogpath/yourlogfile common

to

CustomLog /yourlogpath/yourlogfile combined

See the Apache manual for more information on this directive (possibly installed on your server as www.mysite.com/manual).

B) awstats_configure.pl will then add, if not already present, the following directives to your Apache configuration file (note that the "/usr/local/awstats/wwwroot" path might differ according to your distribution or OS:

#

# Directives to add to your Apache conf file to allow use of AWStats as a CGI.

# Note that path "/usr/local/awstats/" must reflect your AWStats Installation path.

#

Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"

Alias /awstatscss "/usr/local/awstats/wwwroot/css/"

Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"

ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"

#

# This is to permit URL access to scripts/files in AWStats directory.

#

<Directory "/usr/local/awstats/wwwroot">

Options None

AllowOverride None

Order allow,deny

Allow from all

</Directory>

C) if changes were made as indicated in parts A and B, awstats_configure.pl restarts Apache to apply the changes.  To be sure the log format change is effective, go to your homepage. This is an example of the type of records you should see inserted in your new log file after Apache was restarted:

62.161.78.75 - - [dd/mmm/yyyy:hh:mm:ss +0000] "GET / HTTP/1.1" 200 1234 "http://www.from.com/from.html" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"

D) awstats_configure.pl will ask you for a name for the configuration profile file. Enter an appropriate name such as that of your web server or the virtual domain to be analyzed, i.e. mysite.

awstats_configure.pl will create a new file called awstats.mysite.conf by copying the template file awstats.model.conf. The new file location is:

- For Linux/BSD/Unix users: /etc/awstats.

- For Mac OS X, Windows and other operating systems: the same directory as awstats.pl (cgi-bin).

E) awstats_configure.pl ends.

 

* Step 2:

Once a configuration file has been created (by awstats_configure.pl, by your package installer or just by a manual copy of awstats.model.conf), it's important to verify that the "MAIN PARAMETERS" match your needs.  Open awstats.mysite.conf in your favorite text editor (i.e. notepad.exe, vi, gedit, etc) - don´t use a word processor - and make changes as required.

Particular attention should be given to these parameters:

- Verify the LogFile value.  It should be the full path of your server log file (You can also use a relative path from your awstats.pl directory, but a full path avoids errors).

- Verify the LogType value.  It should be "W" for analyzing web log files.

- Check if LogFormat is set to "1" (for "NCSA apache combined/ELF/XLF log format") or use a custom log format if you don't use the combined log format.

- Set the SiteDomain parameter to the main domain name or the intranet web server name used to reach the web site to analyze (Example: www.mysite.com). If you have several possible names for same site, use the main domain name and add the others to the list in the HostAlias parameter.

- You can also change other parameters if you want. The full list is described in Configurations/Directives options page.

Installation and configuration is finished. You can jump to the Process logs: Building/updating statistics database section.

 

B) Setup for Microsoft's IIS server

* Step 1:

Configure IIS to create logs in the "Extended W3C log format" (You can still use your own custom log format but setup is easier if you use the standard extended format). To do so, start the IIS management console snap-in, select the appropriate web site and open its Properties. Choose "W3C Extended Log Format", then Properties, then the Tab "Extended Properties" and uncheck everything under Extended Properties. Once they are all cleared, check just the following fields:

date

time

c-ip

cs-username

cs-method

cs-uri-stem

cs-uri-query

sc-status

sc-bytes

cs-version

cs(User-Agent)

cs(Referer)

 

To be sure the log format change is effective, you must stop IIS, backup it up (if you desire) and remove all of the old log files, restart IIS and go to your homepage. This is an example of the type of records you should find in the new log file:

2000-07-19 14:14:14 62.161.78.73 - GET / 200 1234 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0) http://www.from.com/from.htm 

* Step 2:

Copy the contents of the AWStats provided cgi-bin folder, from where the AWStats package put it on your local hard drive, to your server's cgi-bin directory (this includes awstats.pl, awstats.model.conf, and the lang, lib and plugins sub-directories).

* Step 3:

Move AWStats icon sub-directories and its content into a directory readable by your web server, for example C:\yourwwwroot\icon.

* Step 4:

Create a configuration file by copying awstats.model.conf to a new file named awstats.mysite.conf where "mysite" is a value of your choice but usually is the domain or virtual host name. This new file must be saved in the same directory as awstats.pl (i.e. cgi-bin).

* Step 5:

Edit your new awstats.mysite.conf file to match your specific environment:

- Change the LogFile value to the full path of your web server log file (You can also use a relative path from your awstats.pl (cgi-bin) directory).

- Change the LogType value to "W" for analyzing web log files.

- Change the LogFormat to 2 if you are using the "Extended W3C log format" described in step 1; in the case of a custom format, list the IIS fields being logged, for example:

LogFormat="date time c-ip cs-username cs-method cs-uri-stem cs-uri-query sc-status sc-bytes cs-version cs(User-Agent) cs(Referer)"

- Change the DirIcons parameter to reflect relative path of icon directory.

- Set the SiteDomain parameter to the main domain name or the intranet web server name used to reach the web site being analyzed (Example: www.mydomain.com).

- Set the AllowToUpdateStatsFromBrowser parameter to 1 if you don't have command line access and have only cgi access.

- Review and change other parameters if appropriate.

Installation and configuration is finished. You can jump to the Process logs: Building/Updating statistics database section.

C) Setup for other web servers

The setup process is similar to the setup for Apache or IIS.

Use LogFormat to value "3" if you have WebStar native log format. Use a personalized LogFormat if your log format is other.

D) Setup for other Internet servers, i.e. FTP, Mail, Streaming media

The setup process for other file formats is described in the relevant FAQ topics:  FAQ-COM090: FTP  FAQ-COM100: Mail and FAQ-COM110: Streaming media.

 

II. Process logs: Building/updating statistics database

* Update from command line (recommanded):

The first log analysis should be done manually from the command line since the process may be long and it's easier to solve problems when you can see the command output (if you don't have Command Line access, skip to Step 2). The AWStats create (and update) statistics database command is:

perl awstats.pl -config=mysite -update 

where mysite must be substituted with the domain/virtual host name you selected earlier during AWStats configuration.

AWStats will read the configuration file awstats.mysite.conf (or if not found, awstats.conf) and create/update its database with all summary information issued from analyzed log file.

AWStats statistics database files are saved in directory defined by the DirData parameter in configuration file.

When the create/update is finished, you should see a similar result on your screen:

Update for config "/etc/awstats/awstats.mysite.conf"

With data in log file "/pathtoyourlog/yourlog.log"...

Phase 1 : First bypass old records, searching new record...

Searching new records from beginning of log file...

Phase 2 : Now process new records (Flush history on disk after 20000 hosts)...

Jumped lines in file: 0

Parsed lines in file: 225730

 Found 122 dropped records,

 Found 87 corrupted records,

 Found 0 old records,

 Found 225521 new qualified records.

 

Dropped records are records discarded because they were not "user HTTP requests" or were requests matching AWStats filters (See the SkipHosts, SkipUserAgents, SkipFiles, OnlyHosts, OnlyUserAgents and OnlyFiles parameters). If you want to see which lines were dropped, you can add the -showdropped option on the command line.

Corrupted records are records that do not match the log format defined by the "LogFormat" parameter in the AWStats configuration file. All web servers will typically have a few corrupted records (<5%) even when everything works correctly. This can result for several reasons: 1) Web server internal bugs, 2) bad requests made by buggy browsers, 3) a dirty web server shutdown, such as unplugging the server... 

If all of your lines are corrupted and the LogFormat parameter in AWStats configuration file is correct, then there may be a setup problem with your web server log format. Don't forget that your LogFormat parameter in the AWStats configuration file MUST match the log file format you analyze.  If you want to see which lines are corrupted, you can add the -showcorrupted option on the command line.

Old records are simply records that were already processed by a previous update session. Although it is not necessary to purge your log file after each update process, it is highly recommended that you do so as often as possible.

New records are records in your log file that were successfully used to build/update the statistics database.

Note: A log analysis process might be slow (one second for each 4500 lines of your logfile with an Athlon 1Ghz, plus DNS resolution time for each different IP address in your logfile if DNSLookup is set to 1 and not already done in your log file).  See the Benchmarks page for more detailed information.

 

* Update from a browser:

AWStats statistics can also be updated from a browser, providing real-time statistics, by clicking the "Update now" link that appears when AWStats is used as a CGI (The URL is described in the next section 'Run reports: Building and reading reports').

Warning!!

To enable this link, the configuration file parameter AllowToUpdateStatsFromBrowser must be set to 1 (The link is not enabled by default).

Using the on-line update does not prevent you from running the update process automatically on a scheduled basis (the command is same as that of the first update process above).

For this, you have two choices:

- Include the update command in your logrotate process. See FAQ-COM120 for details.

- Or add instructions in your crontab (Unix/Linux) or your task scheduler (Windows), to regularly launch the Awstats update process. See FAQ-COM130 for details.

See the AWStats Benchmarks page for the recommended update/logrotate frequency.

 

III. Run reports: Building and reading reports

To see the analysis results, you have several options depending on your security policy.

Note: you must have created a statistics data base for the analysis period by processing your log files before you try to create reports.  See the previous section.

1. The first option is to build the main reports, in a static HTML page, from the command line, using the following syntax (skip to the second option if you only have CGI access):

perl awstats.pl -config=mysite -output -staticlinks > awstats.mysite.html 

where mysite must be substituted with the domain/virtual host name you selected earlier during AWStats configuration.

To create specific individual reports, specify the report name on the command line as follows¹:

perl awstats.pl -config=mysite -output=alldomains -staticlinks > awstats.mysite.alldomains.html

perl awstats.pl -config=mysite -output=allhosts -staticlinks > awstats.mysite.allhosts.html

perl awstats.pl -config=mysite -output=lasthosts -staticlinks > awstats.mysite.lasthosts.html

perl awstats.pl -config=mysite -output=unknownip -staticlinks > awstats.mysite.unknownip.html

perl awstats.pl -config=mysite -output=alllogins -staticlinks > awstats.mysite.alllogins.html

perl awstats.pl -config=mysite -output=lastlogins -staticlinks > awstats.mysite.lastlogins.html

perl awstats.pl -config=mysite -output=allrobots -staticlinks > awstats.mysite.allrobots.html

perl awstats.pl -config=mysite -output=lastrobots -staticlinks > awstats.mysite.lastrobots.html

perl awstats.pl -config=mysite -output=urldetail -staticlinks > awstats.mysite.urldetail.html

perl awstats.pl -config=mysite -output=urlentry -staticlinks > awstats.mysite.urlentry.html

perl awstats.pl -config=mysite -output=urlexit -staticlinks > awstats.mysite.urlexit.html

perl awstats.pl -config=mysite -output=browserdetail -staticlinks > awstats.mysite.browserdetail.html

perl awstats.pl -config=mysite -output=osdetail -staticlinks > awstats.mysite.osdetail.html

perl awstats.pl -config=mysite -output=unknownbrowser -staticlinks > awstats.mysite.unknownbrowser.html

perl awstats.pl -config=mysite -output=unknownos -staticlinks > awstats.mysite.unknownos.html

perl awstats.pl -config=mysite -output=refererse -staticlinks > awstats.mysite.refererse.html

perl awstats.pl -config=mysite -output=refererpages -staticlinks > awstats.mysite.refererpages.html

perl awstats.pl -config=mysite -output=keyphrases -staticlinks > awstats.mysite.keyphrases.html

perl awstats.pl -config=mysite -output=keywords -staticlinks > awstats.mysite.keywords.html

perl awstats.pl -config=mysite -output=errors404 -staticlinks > awstats.mysite.errors404.html

 

¹If you prefer, you can use the awstats_buildstaticpages tool to build all these pages in one command, or to generate PDF files.

Notes:

a) You can also add a filter on the following reports: urldetail, urlentry, urlexit, allhosts, refererpages.  The filter can be a regexp (regular expression) on the full key you want AWStats to report on and is appended to the output parameter separated by a ":".

For example, to output the urldetail report, including only pages which contain /news in their URL, you can use the following command line:

perl awstats.pl -config=mysite -output=urldetail:/news -staticlinks > awstats.mysite.urldetailwithfilter.html 

b) If you want to build a report for a particular month, add the options -month=MM -year=YYYY where MM is the month expressed as two digits, i.e. 03, and year is the four digit year.  To build a report for a full year, add the options -month=all -year=YYYY (warning: this is often resource intensive and might use a lot of memory and CPU.  Unix/Linux like operating systems might benefit from use of the "nice" command.)

 

2) The second option is to dynamically view your statistics from a browser.  To do this, use the URL:

http://www.myserver.mydomain/awstats/awstats.pl?config=mysite 

where mysite specifies the configuration file to use (AWStats will use the file awstats.mysite.conf).

All output command line options (except -staticlinks and -logfile) are also available when using AWStats with a browser. Just use them as URL parameters: change "-option" to "&option", i.e.  http://www.myserver.mydomain/awstats/awstats.pl?month=MM&year=YYYY&output=unknownos

Reports are generated in real time from the statistics data base.  If this is slow, or putting too much load on your server, consider generating static reports instead.

If the AllowToUpdateStatsFromBrowser parameter is set to 1 in AWStats configuration file, you will also be able to run the update process from your browser. Just click on the link "Update now".

Your sincere,
------------
KsharP
2007-05-24

2007年5月22日星期二

CVS Install on Linux

CVS Install on Linux

 1 Create a cvs user and a cvs group to own repository files. We won't give any password to this user, so login will be disabled. We'll later add real users to the cvs group.

   $ su

        Password: {enter password}

       # /usr/sbin/groupadd cvs

     # /usr/sbin/useradd �CM �Cg cvs cvsadmin

            #/usr/sbin/useradd �CM �Cg cvs cvscommon

This command normally creates both a user named cvs and a group named cvs.

 

2 Create cvs repository directory in a location of your choice

# mkdir /var/cvsroot

# chown cvsadmin.cvs /var/cvsroot

 

3 Set the 'group sticky bit' on all directories used by CVS

# chmod -R g+ws /var/cvsroot

 

4 Initialize the repository using cvs init

# su cvsadmin

$ cvs �Cd /var/cvsroot init

$ ls -l /var/cvsroot

total 4

drwxrwsr-x 3 cvs cvs 4096 Mar 5 05:32 CVSROOT

 

5 Setting up config

            $ cd /var/cvsroot/CVSROOT

$ chmod u+w config

$vi config

... uncomment or change the line that defines auth...

for example: SystemAutho=no

 

6 Add virtual cvs users

       $ htpasswd  -c �Cd /var/cvsroot/CVSROOT/passwd admin

          Input password for admin

       $ htpasswd   �Cd /var/cvsroot/CVSROOT/passwd tester

          Input password for tester

       Map the virtual cvs users to system user, and the format is "cvsuser:password:systemuser".

       $ vi /var/cvsroot/CVSROOT/passwd

         Append ":cvsadmin" to admin, and append ":cvscommon" to tester.

$ exit

 

7 Start CVS Server

       Check if the cvspserver exists in the path "/etc/xinetd.d", if not please create one under Linux as following.

       #vi /etc/xinetd.d/cvspserver

 service cvspserver

{

        id              = cvspserver

        flags           = REUSE

        socket_type     = stream

        protocol        = tcp

        user            = root

        wait            = no

        server          = /usr/bin/cvs

        server_args     = -f --allow-root=/var/cvsroot pserver

        disable         = no

}

#service xinetd restart

#netstat �Cna |grep 2401

 The port for cvs server is 2401,  and check the server status.

 

9 Check the CVS Server status

          # export CVSROOT=:pserver:tester@localhost:2401/var/cvsroot

          #cvs login

              Input your password. All is ok if no problem.

         #cvs logout

 

10 Update cvs version

       #cd /usr/local/src

       #wget https://ccvs.cvshome.org/files/documents/19/874/cvs-1.12.12.tar.gz

       #tar zxpvf cvs-1.12.12.tar.gz

       #cd cvs-1.12.12

       #./configure

       #make

       #make install

      Install is finished now, please do check again.

       #cvs �Cversion

       #cvs login

          Input your password for tester

      #cvs logout

 

Your sincere,
------------
Henry Zhu
2007-05-23