Chinaunix首页 | 论坛 | 博客
  • 博客访问: 142715
  • 博文数量: 24
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 291
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-01 09:36
文章分类

全部博文(24)

文章存档

2010年(4)

2009年(13)

2008年(7)

我的朋友

分类: 系统运维

2008-12-15 09:43:42


上一篇文章为apache添加了SSI支持, 下面我们来测试一下, 为网页添加访问次数统计:

1. 在/var/apache2/2.2/htdocs下创建一个main.shtml的文件, 内容如下:
# more main.shtml

Last modified: (none)




tfj's web page


stay tuned


this page has been visited times





2. 在/var/apache2/2.2/cgi-bin/下创建一个hitcount.cgi文件, 内容如下:
# more hitcount.cgi
#!/bin/sh

counter=./counter
echo "Content-Type: text/html"
echo ""
read access < $counter
access=`expr $access + 1`
echo $access
echo $access > $counter
3. 在/var/apache2/2.2/cgi-bin/下创建一个counter文件, 内容如下:
# more counter
1
4. 为hitcount.cgi添加执行权限:
# chmod +x hitcount.cgi
5. 为counter添加读写权限:
# chmod 644 counter
6. 使用浏览器访问 刷新页面来查看访问次数不断增加.

Last modified: Monday, 15-Dec-2008 09:36:57 CST


tfj's web page

stay tuned
this page has been visited 20 times




阅读(1274) | 评论(0) | 转发(0) |
0

上一篇:Apache2.2安装与配置

下一篇:Shell 学习笔记

给主人留下些什么吧!~~