linux httpd安装

2. 解压缩
# tar zxf httpd-2.2.4.tar.gz
# cd httpd-2.2.4

3. 安装apache依赖包apr和apr-util,他们都在srclib目录中

3.1 安装apr
# cd srclib/apr
# ./configure --prefix=/usr/local/apr
# make
# make install

3.2 安装apr-util
# cd ../apr-util
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make
# make install

4.安装pcre

#cd pcre-8.10
#./configure --prefix=/usr/local/pcre
#make
#make install

5.安装httpd

# cd ../../
# ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-so --enable-rewrite
# make
# make install

--enable-so 支持DSO模式(动态模块加载方式)
--enable-rewrite 支持rewrite(地址重定向)

启动服务

/usr/local/apache2/bin/apachectl start启动apache

/usr/local/apache2/bin/apachectl stop停止apache

将服务添加至自动启动

echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.d/rc.local   添加自启动

http://192.168.1.104/

如果页面显示如下:
It works!

恭喜你,apache安装成功了~


你可能感兴趣的:(linux httpd安装)