Chinaunix首页 | 论坛 | 博客
  • 博客访问: 92211
  • 博文数量: 30
  • 博客积分: 407
  • 博客等级: 一等列兵
  • 技术积分: 265
  • 用 户 组: 普通用户
  • 注册时间: 2011-04-19 09:20
文章存档

2011年(30)

分类: LINUX

2011-04-19 12:41:59

1Yum install –y gcc*                            安装gcc环境

   Yum install –y openssl*                         安装openssl软件包

 

2.下载httpd源码包;

   Tar –xzvf httpd-2.2.9.tar.gz –C /usr/src        解压源码包到/usr/src目录中<源码包放置目录>

 

3Mkdir –p /usr/local/apache2

 

4./configure  --prefix=/usr/local/apache2  --enable-so            配置编译选项

       --enable-rewrite  --enable-ssl  --with-ssl=/usr/lib  

       --enable-suexec  --with-suexec-caller=daemon

       --with-suexec-docroot=/usr/local/apache2

 

5Make                                                                           编译服务器程序

 

6Make install                                                                                 安装服务器程序

 

7/usr/local/apache2/bin/apachectl  start                                         启动httpd服务

 

8/usr/local/apache2/bin/apachectl  -t                                                    语法检测

 

更改httpd启动方式

1.http脚本复制到/etc/rc.d/init.d这个目录下:

cp -a apachectl /etc/rc.d/init.d/httpd

 

2.vi httpd

#chkconfig: 345 70 70

#description: apache

 

3.添加httpd到启动项:

chkconfig --add httpd

 

4.查看是否有httpd服务:

chkconfig --list httpd

 

源码安装后Apache服务器的根目录:

/usr/local/apache2/

 

日志文件:

/usr/local/apache2/logs/

 

Httpd主配置文件

/usr/local/apache2/conf/httpd.conf

 

Hhttp服务器网页根目录

/usr/local/apache2/htdocs/

 

创建虚拟WEB主机

Cd /usr/local/apache2/htdocs/                                               创建虚拟目录benetcom

Mkdir benetcom

Cd benetcom

Cp /usr/local/apache2/htdocs/index.html ./                                   创建测试网页

Vi index.html                                                                      

 

Cd /usr/local/apache2/conf/                                                  增加虚拟主机配置

Vi httpd.conf

:r extra/httpd-vhosts.conf

80>

#    ServerAdmin webmaster@dummy-host.example.com

     DocumentRoot "/usr/local/apache2/docs/benetcom"

     ServerName

#    ServerAlias

     ErrorLog "logs/benet.com-error_log"

     CustomLog "logs/benet.com-access_log" common

 

RPM安装后的Apache配置文件具体位置

/etc/httpd/                                                                Apache服务程序根目录

/etc/httpd/conf/httpd.conf                                         主配置文件

/var/www/html                                                          网页文档默认根目录

/var/log/httpd/error_log                                            错误日志文件

/var/log/httpd/access_log                                           访问日志文件

阅读(7668) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~