首页 > 代码库 > linux上边搭建Apache服务

linux上边搭建Apache服务

1.

准备工作:

[root@localhost ~]# rpm  -e  httpd --nodeps

2.

 [root@localhost ~]# mkdir 123   创建一个目录

 [root@localhost ~]# mount -ousername=administrator //172.16.1.111/123 空格123把宿主机里面的软件共享到linux上面

技术分享

3.

 [root@localhost123]# tar zxvf httpd-2.2.17.tar.gz  h -C/usr/src 解包

技术分享

4.

[root@localhost /]# cd/usr/src/httpd-2.2.17/

 [root@localhost httpd-2.2.17]# ./configure--prefix=/usr/local/httpd  --enable-so--enable-rewrite --enable-charset-lite --enable-cgi (配置)

5.

[root@localhost httpd-2.2.17]# make&& make install  (编译安装)

6.

[root@localhost httpd-2.2.17]# ls /usr/local/httpd/  (确认安装结果)

技术分享

7.

[root@localhost httpd-2.2.17]# ln -s/usr/local/httpd/bin/* /usr/local/bin/

[root@localhost httpd-2.2.17]# ls -hl/usr/local/bin/ (优化执行路径)

技术分享

8.

[root@localhost ~]# httpd –v  (查看程序版本)

9

[root@localhost ~]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd

添加系统服务

10

[root@localhost ~]# vim /etc/init.d/httpd  添加一下两行

#chkconfig 35 85 21

#description: Startup script for the apachehttp server

技术分享

11.[root@localhost ~]# chkconfig--add httpd   //将httpd添加为系统服务

[root@localhost ~]# chkconfig --list httpd  //查看httpd服务的自启动状态

httpd            0:关闭 1:关闭 2:关闭 3:启用 4:关闭 5:启用 6:关闭

技术分享

12.

[root@localhost ~]# vim/etc/sysconfig/network 修改localhost为www

技术分享

 

[root@localhost ~]#vim /etc/hosts  添加IP映射

技术分享

 

 

[root@localhost ~]# init 6 重启生效

13.

[root@www ~]# vim/usr/local/httpd/conf/httpd.conf 配置httpd服务

  技术分享

修改第97行

14.

[root@www ~]#/usr/local/httpd/bin/apachectl –t  检查语法

Syntax OK

15.

[root@www~]# /etc/init.d/httpd start   启动httpd服务

httpd (pid 1763) already running

16.

[root@www ~]# netstat -anpt | grep httpd  查看端口

17.

[root@www~]#cat/usr/src/local/httpd/htdocs/index.html

18.验证测试

 

 

Linux验证结果:

技术分享

Windows验证结果:

技术分享

 

 

 

部署AWStats分析系统

1.安装AWStats软件包

[root@www123]#tar zxvf awstats-7.3  -C /usr/local/

[root@www local]#mv awstats-7.3 awstats

2. 为统计站点建立配置文件

[root@www]#cd/usr/local/awstats/tools

[root@wwwtools]#chomd a+x awstats_configure.pl

[root@www tools]#./awstats_configure.pl

技术分享

技术分享属入httpd.conf的文件路径 回车 会提示按两次Y

 

技术分享指定要统计的目标网站名称

技术分享

直接按回车

  1. 3.修改站点统计配置文件

[root@www tools]#vim /etc/awstats/awstats.www.benet.com.conf

Logfile="/usr/local/httpd/logs/access_log"(修改这个配置文件)

技术分享

  1. 4.mkdir /var/lib/awstats  创建一个指定日志目录

执行日志分析,并设置cron计划任务

技术分享

  1. 5.访问AWStats

在客户端属入 http://benet.com/awstats/awstats.pl?config=www.benet.com


本文出自 “12323622” 博客,请务必保留此出处http://12333622.blog.51cto.com/12323622/1922274

linux上边搭建Apache服务