`

centos 安装 apache

阅读更多
步骤

shell> cp httpd-2.2.17.tar.bz2  /usr/local

shell> cd /usr/local

shell> tar -jxvf httpd-2.2.17.tar.bz2

shell> cd httpd-2.2.17

shell> ./configure --prefix=/usr/local/apache --enable-so
        # --enable-rewrite --enable-mods-shared=most
        说明:
        --enable-so选项:让Apache可以支持DSO模式,注意,这里采纳使用地是Apache2.0地 语法。如果你地Apache是1.3版本,应改为--enable-module=so。
        --enable-mods-shared=most选项:告诉编译器将所有标准模块都编译为DSO模块。你要是用地是Apache1.3,改为--enable-shared=max就可以。
        --enable-rewrite选项:支持地址重写功能,运用1.3版本地朋友请将它改为--enable-module=rewrite。

shell> make

shell> make install

shell> apachectl start
       启动apache 完整地命令为:/usr/local/apache/bin/apachectl start
       现在测试一下,http://IP ,你会看到apache地默认界面

shell>htmlview 127.0.0.1



修改apache的端口

shell>cd /etc/httpd/conf

shell>vi httpd.conf
    
      修改listen 80 为 listen 8080
      修改servername localhost:8080


apache开机启动

shell>cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

shell>vi /etc/init.d/httpd

在在#!/bin/sh后面加入下面两行
#chkconfig:345 85 15
#description: Start and stops the Apache HTTP Server.

shell>chmod +x /etc/rc.d/init.d/httpd

shell>chkconfig --add httpd

然后可以用setup命令进入服务设置,设置为开机启动




分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics