您的位置:首页 > 理论基础 > 计算机网络

ubuntu下安装apache http server

2015-04-14 15:20 148 查看
在ubuntu下。下载了apache http server直接编译安装的话,configure时会出现“APR not found ”的错误,是因为其所依赖的软件包没有安装。安装过程一步步理清依赖关系,正确使用命令行选项,安装apache
http server会变得很简单。

PS:Apache http server 需要依赖 apr、apr-util、pcre,所以要先下载和安装这三个东东。而apr-util和pcre又依赖apr,所以要先安装apr。



步骤:

1、 下载apr、apr-util、pcre、Apache httpserver

地址如下:

apr/ apr-util: http://apr.apache.org/download.cgi

pcre: http://www.pcre.org/

apache http server: http://httpd.apache.org/download.cgi#apache24

2.分别解压四个文件

例如解压到当前目录:

解压apr : tar –vxf apr-1.5.0.tar.gz(在source目录下会多出一个目录apr-1.5.0)

解压apr : tar –vxf apr-util-1.5.3.tar.gz(在source目录下会多出一个目录apr-util-1.5.3)

解压pcre : tar –vxf pcre-8.33.tar.gz(在source目录下会多出一个目录pcre-8.33)

解压Apache http server:tar –vxf httpd-2.4.9.tar.gz(在source目录下会多出一个目录httpd-2.4.9)

PS:注意,我下载的都是tar.gz格式的,如果是其他格式的,请参考linux关于解压方面的相关命令。

3、 安装apr

切换到apr-1.5.0文件夹下,依次执行命令:

(1)./configure--prefix=/usr/mytest /soft/apr (该命令的意思是配置安装文件,指定安装路径为绝对路径)

(2)make (编译)

(3)make install(安装)

4、 安装apr-util

切换到apr-util-1.5.3文件夹下,依次执行命令:

(1)./configure--prefix=/usr/mytest /soft/apr-util --with-apr=/usr/mytest

/soft/apr/bin/apr-1-config

(该命令的意思是配置安装文件,指定安装路径为绝对路径;且需要依赖apr,否则将会出错)

(2)make (编译)

(3)make install(安装)

5、 安装pcre

切换到pcre-8.33文件夹下,依次执行命令:

(1)./configure--prefix=/usr/mytest /soft/pcre --with-apr=/usr/mytest

/soft/apr/bin/apr-1-config

(该命令的意思是配置安装文件,指定安装路径为绝对路径;且需要依赖apr,否则将会出错)

(2)make (编译)

(3)make install(安装)



6、 安装Apache httpserver

切换到httpd-2.4.9文件夹下,依次执行命令:

(1)./configure--prefix=/usr/mytest /soft/httpd

--with-apr=/usr/mytest/soft/apr/bin/apr-1-config --with-apr-util=/usr/mytest/soft/apr-util/bin/apu-1-config

--with-pcre=/usr/mytest /soft/pcre/bin/pcre-config

(该命令的意思是配置安装文件,指定安装路径为绝对路径;且需要依赖apr/apr-util/pcre,否则将会出错)

(2)make (编译)

(3)make install(安装)

至此安装完成!

7、 启动测试:

(1) 需要首先修改配置文件:(/usr/mytest /soft/httpd/conf/httpd.conf)

ServerName (如127.0.0.1:1025)

Listener (如127.0.0.1:1025)

PS:如果配置文件中Listen定义的是默认的80端口(或1024以下),那么启动Apache将需要root权限以将它绑定在特权端口上。

参考网址:http://www.jinbuguo.com/apache/menu22/invoking.html



(2) 切换到/usr/mytest /soft/httpd/bin目录下,

执行:./apachectl –k start

(3) 到浏览器中输入ServerName配置的属性值,得到:It works!



8、 共享服务器使用说明:

在httpd/htdocs 目录下面增加目录、文件等,浏览器中即可查看。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: