2、APACHE的安装
1)当然还是下载源码包,如:httpd-2.0.55.tar.gz,地址自己找……
2)解压缩,>tar -zxvf httpd-2.0.55.tar.gz
3)进入解压后的httpd-2.0.55,>cd httpd-2.0.55
4)安装配置,>./configure --prefix=/opt/apache --enable-cgi
5)编译,>make
6)安装,>make install
7)启动,>/opt/apache/bin/apachectl start (restart 重启,stop停止)
现在打开浏览器,输入http://localhost,即可看到apache的欢迎界面。
注:
1)apache配置文件的修改,路径:/opt/apache/conf/httpd.conf,修改完配置文件记得重启apache
*修改默认首页:DirectoryIndex index.html index.html,改为:DirectoryIndex index.html index.html index.php
*添加执行PHP文件:AddType application/x-httpd-php .php
*修改默认编码:AddDefaultCharset utf-8
2)apache建立虚拟机
NameVirtualHost *:80
<VirtualHost *:80>
ServerName test.test.com
DocumentRoot /opt/htdocs/test
</VirtualHost>

本文详细介绍Apache服务器从源码包安装到基本配置的过程,包括安装步骤、启动方法及如何通过浏览器验证安装成功。此外还介绍了如何修改Apache配置文件来设置默认首页、支持PHP文件以及更改默认字符编码。
1207

被折叠的 条评论
为什么被折叠?



