安装之前定义一个完整的主机名 : 否则在启动apache的时候会有这样的报错: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message 编辑/etc/hosts 文件 # Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.87.128 centos.wolf.org centos
编辑 /etc/sysconfig/network 文件,然后重启才能生效 NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=centos.wolf.org
1, apache 安装 tar xvfz httpd-2.2.11.tar.gz cd httpd-2.2.11
./configure --prefix=/usr/local/apache --enable-so # --prefix=<Install_Path> 指明编译后的二进制文件安装到<Install_Path>目录,用实际安装路径替换<Install_Path>,如--prefix=/usr/local/apache-2.2.11 ,如果省略此配置参数,默认安装到/usr/local/apache2目录。
# --enable-so 指明编译动态加载模块(DSO)支持到httpd二进制文件,此模块使得Apache的各功能模块可以与核心分开编译、运行时动态加载。有了DSO支持,升级和增加模块时只需编译相关的模块即可,不必重新编译整个系统。最新版本的Apache缺省编译此模块到httpd二进制文件,如果你在使用早期版本的apache并且需要DSO支持,可能要明确指出此选项。
# --enable-mods-shared=<MODULE-LIST> 明确指明要以DSO方式编译的模块,<MODULE-LIST>为空格分隔的模块名列表、all或者most,all表示包含所有模块,most表示包含大部分模块,如--enable-mods-share="rewrite deflate",--enable-mods-share=most,效果等同于多个--enable-<FEATURE>=share
make && make install
/usr/local/apache/bin/apachectl restart 启动 httpd echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local 加入开机
由于编译安装的时候http服务默认的用户组和用户名是daemon,在这里我还是改成习惯的apache [iyunv@centos httpd-2.2.11]# id apache
uid=48(apache) gid=48(apache) groups=48(apache) context=root:system_r:unconfined_t:SystemLow-SystemHigh [iyunv@centos httpd-2.2.11]# cd /usr/local/apache/conf/
[iyunv@centos conf]# vim httpd.conf User apache
Group apache
遇到的问题: [iyunv@centos httpd-2.2.11]# service httpd restart
Stopping httpd: [FAILED]
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[FAILED] 这是由于端口被占用了,所以至于要kill就行了 [iyunv@centos apache]# ps aux|grep http
root 10271 0.0 0.0 61228 728 pts/1 R+ 14:45 0:00 grep http
daemon 32757 0.0 0.1 29144 1444 ? S 14:19 0:00 /usr/local/apache/bin/httpd -k start
daemon 32758 0.0 0.1 29144 1444 ? S 14:19 0:00 /usr/local/apache/bin/httpd -k start
daemon 32759 0.0 0.1 29144 1444 ? S 14:19 0:00 /usr/local/apache/bin/httpd -k start
[iyunv@centos apache]# kill -9 32757
[iyunv@centos apache]# kill -9 32758
[iyunv@centos apache]# kill -9 32759
[iyunv@centos apache]# ps aux|grep http
root 10447 0.0 0.0 61228 752 pts/1 S+ 14:47 0:00 grep http
[iyunv@centos apache]# /usr/local/apache/bin/apachectl start
[iyunv@centos apache]# /usr/local/apache/bin/apachectl start
httpd (pid 10463) already running
[iyunv@centos apache]#
[iyunv@centos apache]# ps aux|grep http
root 10463 0.0 0.1 24936 1784 ? Ss 14:47 0:00 /usr/local/apache/bin/httpd -k start
apache 10464 0.0 0.1 24936 1340 ? S 14:47 0:00 /usr/local/apache/bin/httpd -k start
apache 10465 0.0 0.1 24936 1340 ? S 14:47 0:00 /usr/local/apache/bin/httpd -k start
apache 10466 0.0 0.1 24936 1340 ? S 14:47 0:00 /usr/local/apache/bin/httpd -k start
|