[root@Centos /]# tar xzvf /mnt/httpd-2.2.17.tar.gz -C /usr/src/ 一.安装配置apache。 1)配置。 [root@Centos httpd-2.2.17]# ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi #–enable-so :启动动态加载模块支持,使http具备进一步扩展功能的能力 #–enable-rewrite :启用页面地址重写功能,用于网站优化及目录迁移维护 #–enable-charset-lite :启用字符集支持,以便支持使用各种字符集编码的网页 #–enable-cgi :启用CGI脚本程序支持,便于扩展网站的应用访问能力 2)编译和安装。 [root@Centos httpd-2.2.17]# make && make install 二.优化程序和配置服务。 [root@Centos /]# ln -s /usr/local/httpd/bin/* /usr/local/bin/ #优化程序执行目录 [root@Centos /]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd #生成apache服务 [root@Centos /]# chmod +x /etc/init.d/httpd #添加执行权限 [root@Centos /]# vim /etc/init.d/httpd #修改apache服务的控制文件 #!/bin/sh #chkconfig: 35 80 21 #description:chkconfig --add httpd [root@Centos /]# chkconfig --add httpd #添加为系统文件 [root@Centos /]# chkconfig --level 35 httpd on #设置服务开机自动启动 三.主配置文件httpd.conf中的选项。 [root@Centos /]# cat /usr/local/httpd/conf/httpd.conf 1)apache安装的根目录 /ServerRoot 2)apache服务监听的域名或者IP地址。 /ServerName 3)apache出现异常邮件发给谁。 /ServerAdmin 4)网页根目录。 /DocumentRoot 5)设置网站默认管理的王爷类型。 /DirectoryIndex 6)管理apache的账户daemon和组账户。 /User /Group 7)虚拟主机的配置文件。 Include conf/extra/httpd-vhosts.conf 8)设置网站根目录访问权限,网站的区域配置文件。
</Directory>9) 监听端口默认为80。 /Listen 80