参考:
https://www.cnblogs.com/xhkj/p/6568379.html
https://blog.csdn.net/qq_39591494/article/details/78726580
Apache至少需要apr、apr-util、pcre组件的支持。
http://mirrors.hust.edu.cn/apache/httpd/
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.37.tar.bz2
http://mirrors.hust.edu.cn/apache/apr/apr-1.6.5.tar.bz2
http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.1.tar.bz2
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.bz2
# yum install -y bzip2
*** 编译安装apr
# tar -xjvf apr-1.6.5.tar.bz2
# cd apr-1.6.5
# ./configure --prefix=/usr/local/apr
# make && make install
*** 编译安装 apr-uril
# yum install -y expat-devel
# tar -xjvf apr-util-1.6.1.tar.bz2
# cd apr-util-1.6.1
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make && make install
*** 编译安装pcre
# yum -y install pcre pcre-devel
# cd pcre-8.42
# ./configure -prefix=/usr/local/pcre
# make && make install
*** 编译安装apache
# tar -xjvf httpd-2.4.37.tar.bz2
# cd httpd-2.4.37
# ./configure -prefix=/usr/local/apache24 -sysconfdir=/etc/httpd -enable-so -enable-rewrite -with-apr=/usr/local/apr -with-apr-util=/usr/local/apr-util -with-pcre=/usr/local/pcre
# make && make install
配置apache防火墙
# firewall-cmd --permanent --add-service=http
# firewall-cmd --reload
# vi /etc/httpd/httpd.conf
在#ServerName www.example.com:80 下增加下面的语句
ServerName localhost:80
使用脚本控制Apache,启动服务
# /usr/local/apache2/bin/apachectl start
# /usr/local/apache2/bin/apachectl stop
#服务启动后,在浏览器输入http://localhost浏览器内容显示出it works,该内容存在于/usr/local/apache2/htdocs/index.html文件中
# /usr/local/apache24/bin/apachectl -M ==列出启动的 Apache 模块。
# /usr/local/apache24/bin/apachectl status
/usr/local/apache24/bin/apachectl:行95: lynx: 未找到命令
解决:#yum -y install lynx
设置apache开机启动
方法一:将服务加到/etc/rc.d/rc.local中
# vi /etc/rc.d/rc.local
/usr/local/apache24/bin/apachectl start ==添加内容
# chmod +x /etc/rc.d/rc.local
相应的删除自启动方法
删除/etc/rc.d/rc.local中的/usr/local/apache24/bin/apachectl start这一行的内容,
并且执行# chmod -x /etc/rc.d/rc.local
方法二:
1、将apachectl命令拷贝到/etc/init.d目录下,改名为httpd
# cp /usr/local/apache24/bin/apachectl /etc/init.d/httpd
2、编辑/etc/init.d/httpd文件,在第1行#!/bin/sh的后面添加如下两行
# vi /etc/init.d/httpd
# chkconfig: 2345 70 30 //注意:前面的#号是要保留的
# description: Apache //注意:前面的#号是要保留的
其中,所增加的第二行中三个数字,第一个表示在运行级别2345下启动Apache,第二、三是关于启动和停止的优先级配置。
3、Apache服务尚未被添加到chkconfig列表中,需要使用–add参数将其添加进去
# chkconfig --add httpd
# chkconfig --list httpd ==查看
相应的删除自启动方法
# chkconfig --del httpd
# rm -f /etc/init.d/httpd
分享到:
相关推荐
此资源用于非https的离线Apache安装包,如需配置https,需要补充优化。
CentOS 6.2编译安装Apache2.4.1+MySQL5.5.21+PHP5.3.10
CentOS 5.6编译安装Apache2.4.1+MySQL5.5.21+PHP5.3.10
主要介绍了centos7上编译安装php7以php-fpm方式连接apache的相关知识,非常不错,具有一定的参考借鉴价值,需要的朋友可以参考下
CentOS6.2编译安装Apache2.4.1+MySQL5.5.21+PHP5.3.10.pdf
安装Apache之前,我们需要安装编译Apache和所依赖的一些软件包,其中有:gcc、gcc-c++、apr、apr-util、pcre等包。 ① 安装gcc、gcc-c++编译环境 [root@localhost ~]# yum install gcc gcc-c++ ② 安装...
主要介绍了CentOS环境下单独安装apachebench的方法,分析了apachebench的安装步骤与相关注意事项,需要的朋友可以参考下
源码编译安装 apache2.2.31 + php5.3.29 + memcache 自动安装mysql,mysqlli,pdo_mysql,openssl,curl,gd,memcache等扩展。 chmod +x hj.sh ./hj.sh 如果提示:no such file or directory:说明hj.sh非unix编码重新...
主要介绍了CentOS 6.5上编译安装Apache服务器的方法(最小化安装),需要的朋友可以参考下
Hadoop2.7.2 centos7 64位编译后的库文件
除了编译器使用yum安装,其他全部手动编译。哼~ 看似就Nginx、PHP、MySql三个东东,但是它们太尼玛依赖别人了。 没办法,想用它们就得老老实实给它们提供想要的东西。 首先的一些模块依赖一些lib库, 如果你是懒人,...
在centos7下编译hadoop2.7.3所需工具:apache-ant-1.9.4-bin.tar.gz、apache-maven-3.3.3-bin.tar.gz、findbugs-3.0.1.tar.gz、hadoop-2.7.3-src.tar.gz、protobuf-2.5.0.tar.gz
CentOS-64的虚拟机安装和Apache编译安装
CentOS_4[1].4_源码编译安装Apache+PHP+MySQL
编译安装环境:yum -y installmake gcc-c++ cmake bison-devel ncurses-devel gcc\下载mysql5.6
centos7 以源码方式安装Apache。并介绍Aapche配置文件里面内容的含义是什么。 (2)了解Aapche配置文件内容好处: ①灵活性和可定制性: 了解 Apache 的配置文件可以帮助理解和掌握各种配置选项,以满足特定的需求...
centos5.2下配置apache+mysql+php 源码安装编译