您现在的位置:首 页 >> Apache >> 查看文章
Debian5.0安装Apache和配置使用
文/王以轩

 
 
  Debian默认安装的Apache不习惯使用,路径也不喜欢,还有配置文件。还是自己编译用着顺手。
wget http://labs.xiaonei.com/apache-mirror/httpd/httpd-2.2.14.tar.gz
tar zxvf httpd-2.2.14.tar.gz
cd httpd-2.2.14
./configure --prefix=/usr/local/apache --enable-deflate=shared --enable-headers=shared --enable-info=shared --enable-rewrite=shared --enable-so
make
make install
cd ../

groupadd www
useradd -g www www
mkdir -p /home/wwwroot
chmod +w /home/wwwroot
chown -R www:www /home/wwwroot
  上面的参数中默认安装了Rewrite伪静态模块和Deflate模块。
  并且,我们添加了一个www用户和www用户组,以便访问web文件夹。
  网站的目录我们建在/home/wwwroot这里。
  安装完了之后,我们还要配置一下Apache的目录访问权限。
  用vi打开/usr/local/apache/conf/httpd.conf文件
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
  这里改成
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
  如果要绑定域名,还需要在配置文件中修改这里,将其中的域名改成你自己的。
ServerAdmin no-reply@abc.net
DocumentRoot "/home/wwwroot"
ServerName www.wyxuan.com
ServerAlias www.wyxuan.com
ErrorLog "logs/www.wyxuan.com-error_log"
CustomLog "logs/www.wyxuan.com-access_log" common
  这时我们可以启动Apache了。
/usr/local/apache/bin/apachectl -k start
  找个index.html文件放到/home/wwwroot目录下,用IP或者绑定的域名访问一下看看吧。

  下面是一些经常要用到的方法
  重启Apache
/usr/local/apache/bin/apachectl -k restart
  检查配置
/usr/local/apache/bin/apachectl configtest
  检测Apache运行模块
/usr/local/apache/bin/httpd -l
 
 

日期:2010-02-11 00:32:46 浏览次数:259
作品版权所有,未经『王以轩』同意,其他媒体一律不得转载
Copyright © 2006-2009 Wyxuan.Com All Rights Reserved .