Chinaunix首页 | 论坛 | 博客
  • 博客访问: 37283
  • 博文数量: 13
  • 博客积分: 730
  • 博客等级: 军士长
  • 技术积分: 165
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-11 19:13
文章分类

全部博文(13)

文章存档

2010年(13)

我的朋友
最近访客

分类: LINUX

2010-01-23 17:58:24

在linux下安装apache的方法

首先从官方网站上下载httpd-2.2.3.tar.gz安装文件,将文件放在/usr/local目录下

下面开始开装httpd-2.2.3.tar.gz文件

1.# cd /usr/local                   //进入此目录

2.# tar zxvf httpd-2.2.3.tar.gz    //解压httpd-2.2.3.tar.gz

3.# cd httpd-2.2.3                //进入httpd-2.2.3目录

4.# mkdir -p /usr/local/apache    //生成/usr/local/apache目录

5.# ./configure \

  >--prefix=/usr/local/apache \

  >--enable-modules=so \

  >--enable-rewrite              // 检查目录

[注释:

–prefix      //指定安装目录  

–sysconfdir  //指定配置文件存放目录,即httpd.conf –enable-mods-shared要以DSO

               加载的模块,most是大部分,还有可选all即全部 

–with-mpm   //服务器处理请求的模式,是worker(多线程模式)还是prefork(多进程模式) –with-port  //端口


6.#make && make install         //安装apache

7.把httpd加入到系统服务中

# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd

注释:注释:加入到系统服务中,就可以通过service httpd start|stop|restart等进行管理

8.把httpd加入到开机启动项中

先修改
# vi /etc/init.d/httpd

# chkconfig –add  httpd
# chkconfig httpd –level 345 on

9.# /usr/local/apache/bin/apachectl -k start //启动apahce

用浏览器查看 得到 It Works说明apache已经配置成功了。

# /usr/local/apache/bin/apachectl -k stop //停止apache。

10.其他

这样安装,服务器默认根目录是/usr/local/httpd/htdocs,要更改该目录,可以在修改vim /etc/httpd/httpd.conf 中的DocumentRoot,安装httpd后,一般新模块的安装一般通过 ./configure的时候指定–with-apxs=/usr/local/httpd/bin/apxs即可,某些特殊模块有其独特编译安装方式

阅读(584) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~