Apache Httpd在linux环境下安装配置指南
一、安装环境
◆ Red Hat AS 5.0
二、安装包准备
◆ httpd-2.2.9.tar.gz
三、安装目录准备
◆ /usr/local/httpd-2.2.9
四、安装步骤
◆ 用户:root
◆ 将压缩文件:httpd-2.2.9.tar.gz拷贝到/usr/app/下面
◆ 解压缩文件
#cd /usr/app/
#tar –vzxf httpd-2.2.9.tar.gz
#cd httpd-2.2.9
◆ 创建安装目录
#mkdir –p /usr/local/httpd-2.2.9
#chmod –R 777 /usr/local/httpd-2.2.9
#./configure --prefix=/usr/local/httpd-2.2.9
#make
#make install
五、配置
#vi /usr/local/httpd-2.2.9/conf/httpd.conf
序号 | 属性项 | 值 |
1 | ServerRoot "/usr/local/httpd-2.2.9" | 默认(httpd安装目录) |
2 | Listen 80 | 80为端口,根据实际调整 如:Listen 8090 |
3 | #ServerName www.example.com:80 | 设为: ServerName localhost:8090 [端口与Listen一致] |
六、启动/停止
◆ 启动
#/usr/local/httpd-2.2.9/ bin/apachectl start
◆ 停止
#/usr/local/httpd-2.2.9/ bin/apachectl stop
◆ 查看服务
#ps aux|grep httpd
七、发布测试
看到此页面说明安装配置成功
八、高级配置
◆ 限制IP访问
找到发布目录信息节点:
<Directory "/usr/local/httpd-2.2.9/htdocs"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit AllowOverride None # # Controls who can get stuff from this server. Order allow,deny # 默认不限制IP访问[all] #Allow from all # 只允许0.20、0.151 二台服务器访问该Web服务 Allow from 192.168.0.20 192.168.0.151 </Directory> |
◆ 更多配置请参考
整理于:2009-09-15PM 杭州