linux安装apache命令,Linux下tar安装apache服务

在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即可,某些特殊模块有其独特编译安装方式

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值