- 英文版部署说明 请参照 http://httpd.apache.org/docs/current/install.html
- 下载httpd http://httpd.apache.org/download.cgi 点击下载 httpd-2.4.9.tar.gz
- ftp上传到linux服务器 ,解压tar -xf httpd-2.4.9.tar.gz
- 进入 刚解压的httpd目录 cd httpd-2.4.9
- 配置./configure --prefix /user/local/httpd-2.4.9
- 本人执行到这步时出错,错误信息主要如下
- checking for APR... no 没有找到 apr
configure: error: APR not found. Please read the documentation. - 英文版中有Requirements :the following requirements exist for building Apache httpd:
- 去 http://apr.apache.org/download.cgi 下载apr-1.5.0.tar.gz[必须] 、apr-util-1.5.3.tar.gz[必须]、apr-iconv-1.2.1.tar.gz[暂时没用到]
- 去 http://www.pcre.org/ 下载最新的pcre[必须]
- 分别解压并安装 3个必须的文件,在安装过程中如果觉得安装失败想删除重新开始 只要查找 whereis apr 或apr-util或pcre 然后 rm -rf 掉找到的目录即可
- 安装apr
- tar -xf apr-1.5.0.tar.gz
- cd apr-1.5.0
- ./configure --prefix=/usr/local/apr
- make
- make install
- 安装 apr-tuil
- tar -xf apr-util-1.5.3.tar.gz
- cd apr-util-1.5.3
- ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
- make
- make install
- 安装pcre
- 注:linux下安装安装pcre可能错误 configure: error: You need a C++ compiler for C++ support 解决办法:yum install -y gcc gcc-c++
- tar -xf pcre-8.35.tar.gz
- cd pcre-8.35
- ./configure --prefix=/usr/local/pcre
- make
- make install
- 安装完后 可以看一下ls /usr/local 目录下 多出 apr, apr-util,pcre 3个文件夹
- 这时再进入httpd-2.4.9目录 ./configure --prefix =/usr/local/apache2 --with-pcre=usr/local/pcre 我是这么执行的 如果说找不到apr 或者 apr-util 可以用 --with-apr =/usr/local/apr --with-apr-util =/usr/local/apr-util 来指定.
- make
- make install
- 安装完成后 /usr/local 目录下 多出apache2文件夹。
- cd /usr/local/apache2/bin 启动apache ./apachectl start
- 注:启动apache时可能错误:Could not reliably determine the server`s fully qualified domain name 这个貌似不影响启动 解决办法是 修改 apache2/conf/httpd.conf 文件 找到ServerName 所在行解除#号注释 并修改ip地址 或 直接添加一行ServerName localhost:80
- 最后访问 http://ip地址 出现
It works!
linux 安装部署 apache http server
最新推荐文章于 2024-04-02 21:27:01 发布