centos7安装httpd服务编译安装apache要注意的事情
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7安装httpd服务编译安装apache要注意的事情相关的知识,希望对你有一定的参考价值。
apr,apr-util下载地址:http://archive.apache.org/dist
wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
Pcre 下载地址
wget https://ftp.pcre.org/pub/pcre/pcre-8.38.tar.gz
yum install gcc gcc-c++ -y 这个必须要安装,否则会报错
[root@yeshuai ~]# ll
总用量 3876
-rw-------. 1 root root 1227 10月 1 2019 anaconda-ks.cfg
-rw-r--r--. 1 root root 1031613 4月 29 2015 apr-1.5.2.tar.gz
-rw-r--r--. 1 root root 874044 9月 20 2014 apr-util-1.5.4.tar.gz
-rw-r--r--. 1 root root 2053336 7月 21 2017 pcre-8.38.tar.gz
[root@yeshuai ~]#
[root@yeshuai ~]# tar zxf apr-1.5.2.tar.gz
[root@yeshuai ~]# cd apr-1.5.2
[root@yeshuai ~]# ./configure --prefix=/usr/local/apr
[root@yeshuai ~]# make && make install
[root@yeshuai ~]# tar zxf apr-util-1.5.4.tar.gz
[root@yeshuai ~]# cd apr-util-1.5
[root@yeshuaiapr-util-1.5.4]#./configure --prefix=/usr/local/web/apr-util -with-apr=/usr/local/apr
[root@yeshuai apr-util-1.5.4]# make && make install
[root@yeshuai ~]# tar zxf pcre-8.38.tar.gz
[root@yeshuai ~]# cd pcre-8.38
[root@yeshuai pcre-8.38]# ./configure --prefix=/usr/local/pcre
[root@yeshuai pcre-8.38]# make && make install
Apache 安装过程
1.下载apache
历史版本下载:
http://archive.apache.org/dist/httpd/
[root@yeshuai ~]# wget http://archive.apache.org/dist/httpd/httpd-2.4.33.tar.gz
[root@yeshuai ~]# tar zxf httpd-2.4.33.tar.gz
[root@yeshuai ~]# cd httpd-2.4.33
[root@yeshuaihttpd-2.4.33]#./configure --prefix=/usr/local/apache2.4.33
--enable-expires
--enable-headers
--enable--modules=most
--enable-so
--enable-rewrite
--with-mpm=worker
--with-apr=/usr/local/apr
--with-apr-util=/usr/local/web/apr-util
--with-pcre=/usr/local/pcre
[root@yeshuai httpd-2.4.33]# make && make install
[root@yeshuai ~]# /usr/local/apache2.4.33/bin/apachectl
AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using fe80::20b7:18c6:149e:92fd. Set the ‘ServerName‘ directive globally to suppress this message
Vi /usr/local/apache2.4.33/conf
把httpd.conf中的#ServerName www.example.com:80 注释取消掉
这里会发现 centos图形界面能打开网站,其他主机却打不开,这里是因为防火墙未关闭
[root@yeshuai conf]# systemctl stop firewalld.service
[root@yeshuai conf]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@yeshuai conf]#
以上是关于centos7安装httpd服务编译安装apache要注意的事情的主要内容,如果未能解决你的问题,请参考以下文章