下载地址(例):wget https://dlcdn.apache.org/httpd/httpd-2.4.54.tar.gz
创建安装目录:mkdir /usr/local/apache2
易错步骤梳理:
【修正一】
b:解决APR-util not found问题>>>>
1.[root@xt test]# tar -zxf apr-util-1.3.12.tar.gz
2.[root@xt test]# cd apr-util-1.3.12
3.[root@xt apr-util-1.3.12]# ./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr
(原指令多了个空格)
4.[root@xt apr-util-1.3.12]# make && make install
最终安装指令:
./configure –prefix=/usr/local/apache2 –enable-module=shared –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util –with-pcre=/usr/local/pcre
make && make install
【修正二】
pcre如果安装后编译apache时报”error: Did not find working script at pcre-config”,那就是pcre的配置不要指定路径,然后再试一试
【修正三】
按上面教程安装后的路径为:/usr/local/apache2
配置文件
编辑 /usr/local/Apache2/conf/httpd.conf 文件
找到:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
在后面添加:
AddType application/x-httpd-php .php #使Apcche支持PHP
AddType application/x-httpd-php-source .php5
找到:
DirectoryIndex index.html
添加:
DirectoryIndex index.html index.php
找到:
#ServerName www.example.com:80
修改为:
ServerName 127.0.0.1:80
ServerName localhost:80
记得要去掉前面的”#”
启动、重启、停止(注意路径)
/usr/local/apache2/bin/apachectl -k start
/usr/local/apache2/bin/apachectl -k restart
/usr/local/apache2/bin/apachectl -k stop
Original: https://www.cnblogs.com/brad93/p/16666497.html
Author: 星仔1208
Title: Apache手动安装教程及报错解决梳理
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/577685/
转载文章受原作者版权保护。转载请注明原作者出处!