侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

CentOS 7 Apache 2.4.23 安装 配置 启动

2023-12-05 星期二 / 0 评论 / 0 点赞 / 84 阅读 / 3550 字

下载Apache安装包 httpd-2.4.23.tar.gz 下载地址:http://apache.fayea.com/httpd/ Apache 安装要求 必须安装APR、APR-Util、PCR

下载Apache安装包  httpd-2.4.23.tar.gz

下载地址:http://apache.fayea.com/httpd/

Apache 安装要求

必须安装APR、APR-Util、PCRE,gcc-c++等包

编译命令:(除了指定Apache的安装目录外,还要安装apr、apr-util、pcre,并指定参数)

[root@bogon software]# tar -zxvf httpd-2.4.23.tar.gz[root@bogon software]# cd httpd-2.4.23[root@bogon httpd-2.4.23]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre checking for chosen layout... Apachechecking for working mkdir -p... yeschecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking target system type... x86_64-unknown-linux-gnuconfigure: configure: Configuring Apache Portable Runtime library...configure: checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.[root@bogon httpd-2.4.23]# 

在编译Apache时出现了问题

http://apr.apache.org/download.cgi  下载apr-1.5.2.tar.gz、apr-util-1.5.4.tar.gz
http://www.pcre.org/ 官网
https://sourceforge.net/projects/pcre/files/pcre/  选择pcre下载,不用pcre2
下载最新版本pcre-8.39.tar.gz

解决apr问题

[root@bogon software]# tar -zxvf  apr-1.5.2.tar.gz[root@bogon software]# cd apr-1.5.2/[root@bogon apr-1.5.2]# ./configure --prefix=/usr/local/apr[root@bogon apr-1.5.2]# make[root@bogon apr-1.5.2]# make install

解决APR-util问题 

[root@bogon software]# tar -zxvf apr-util-1.5.4.tar.gz[root@bogon software]# cd apr-util-1.5.4/[root@bogon apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config[root@bogon apr-util-1.5.4]# make[root@bogon apr-util-1.5.4]# make install

解决pcre-config问题

[root@bogon software]# tar -zxvf pcre-8.39.tar.gz[root@bogon software]# cd pcre-8.39[root@bogon pcre-8.39]# ./configure --prefix=/usr/local/pcre[root@bogon pcre-8.39]# make[root@bogon pcre-8.39]# make install

 

再次编译httpd-2.4.23:

[root@bogon software]# cd httpd-2.4.23[root@bogon httpd-2.4.23]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre [root@bogon httpd-2.4.23]# make[root@bogon httpd-2.4.23]# make install

启动Apache:/usr/local/apache2/bin/apachectl start
停止Apache:/usr/local/apache2/bin/apachectl stop
重启Apache:/usr/local/apache2/bin/apachectl restart

网站放在/usr/local/apache2/htdocs目录下

在IE中通过http://localhost:80,如果看到页面中显示“It works!”字样,则代表Apache验证通过。如果网站的index后缀是PHP格式的,则要修改httpd.conf配置文件(/usr/local/apache2/conf),在DirectoryIndex增加 index.php。

## DirectoryIndex: sets the file that Apache will serve if a directory# is requested.#<IfModule dir_module>    DirectoryIndex index.html index.php</IfModule>

 

广告 广告

评论区