现在的位置: 首页 > 综合 > 正文

ubuntu 编译安装apache

2013年10月09日 ⁄ 综合 ⁄ 共 795字 ⁄ 字号 评论关闭

1. wget 

http://labs.renren.com/apache-mirror//httpd/httpd-2.2.22.tar.gz

2  tar -zxvf  httpd-2.2.22.tar.gz

3、cd  httpd-2.2.22

#./configure --prefix=/usr/local/apache2 --enable-module=so
#make
# sudo make install

实际执行过程中可能要求你有root权限,所以要求使用sudo.
如果需要mod_rewrite模块,需要加参数: --enable-rewrite

4.启动和停止apache
启动:sudo /usr/local/apache2/bin/httpd -k start

启动sudo /usr/local/apache2/bin/apachectl  start

停止sudo /usr/local/apache2/bin/apachectl  stop

重启 sudo /usr/local/apache2/bin/apachectl  restart

启动时提示:
  httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName.

解决办法是在http.conf中加一行:
  ServerName 127.0.0.1:80

停止:sudo /usr/local/apache2/bin/httpd -k stop

5.让Ubuntu开机自动启动apache.
1). 复制 /usr/local/apache2/bin/apachectl到/etc/init.d
2). 加载为服务
     sudo update-rc.d apachectl defaults

开机重启访问http://localhost/如果显示apache的网页,就说明自动启动成功了。

抱歉!评论已关闭.