Centos7源码安装Apache和PHP
源码安装Apache
安装需要的依赖
yum -y install gcc autoconf automake make pcre pcre-devel openssl openssl-devel
#pcre是正则表达式库
#openssl是安全通信的库
安装apr和apr-until
#apr是Apache可移植运行时
#apr-until是Apache可移植运行时实用程序库
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar xf apr-1.7.0.tar.gz
tar xf apr-util-1.6.1.tar.gz
cd apr-1.7.0
./configure
make && make install
cd ..
cd apr-util-1.6.1
./configure --with-apr=/usr/local/apr/
make && make install
cd ..
安装Apache
服务和模块
wget https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.41.tar.gz
tar xf httpd-2.4.41.tar.gz
cd httpd-2.4.41
./configure --prefix=/usr/local/apache2 --enable-so --enable-ssl --enable-rewrite --with-mpm=worker --with-suexec-bin --with-apr=/usr/local/apr/
make && make install
vim /usr/local/apache2/conf/httpd.conf #Apache配置文件
/usr/local/apache2/bin/apachectl start #启动Apache服务
/usr/local/apache2/bin/apachectl stop #停止
选项 | 描述 |
---|---|
--prefix | 指定 Apache httpd 程序的安装主目录 |
--enable-so | 开启模块化功能,支持DSO(动态共享对象) |
--enbale-ssl | 支持 SSL 加密 |
--enable-rewrite | 支持地址重写 |
--with-mpm | 设置 Apache httpd 工作模式 |
--with-suexec-bin | 支持 SUID、SGID |
--with-apr | 指定 apr 程序的绝对路径 |
将其设置为开机启动
mv /root/httpd-2.4.41/build/rpm/httpd.init /etc/rc.d/init.d/httpd #从源码包移动脚本到启动目录
vim /etc/rc.d/init.d/httpd #修改以下内容
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
pidfile=${PIDFILE-/usr/local/apache2/logs/${prog}.pid}
CONFFILE=/usr/local/apache2/conf
#在/etc/rc.d/init.d目录下运行,以下命令
chkconfig --add httpd
chkconfig --level 2345 httpd on #设置为开机启动
chkconfig --list #可以看到httpd已经添加到开机启动,且2345为on
源码安装PHP
安装依赖
yum -y install libxml2 libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel
安装PHP和所需模块
wget https://www.php.net/distributions/php-7.3.12.tar.gz
tar xf php-7.3.12.tar.gz
cd php-7.3.12
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-libxml-dir --with-curl --with-gd --with-openssl --enable-sockets --with-pear --enable-exif --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
make && make install
参数解释:https://blog.csdn.net/niluchen/article/details/41513217
如果PHP不解析,用以下方法
#在apache配置文件中添加以下信息,然后重启apache
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html
Centos7源码安装Apache和PHP的更多相关文章
- centos7源码安装Apache及Tomcat
源码安装Apache (1) 一.通过 https://apr.apache.org/ 下载 APR 和 APR-util 通过 http://httpd.apache.org/download.c ...
- 烂泥:源码安装apache
本文由秀依林枫提供友情赞助,首发于烂泥行天下. 最近要开始学习nagios监控方面的知识了,但是nagios与apache结合的比较紧密,所以本篇文章就先把apache的源码安装学习下. 我们现在分以 ...
- 源码安装apache
目标:源码安装apache 依赖包:apr.apr-util和pcre.其中pcre正则库要先安装,apr和apr-util(已解压)可以复制到apache下的资源库srclib下. 安装pcre: ...
- linux下源码安装apache服务
1.搭建静态网站是,我们只需要搭建apache服务即可满足要求. 例如:如果我再客户端游览器输入地址,他会找到192.168.1.100这个服务器,然后根据端口会找到apache服务器.apache他 ...
- centos7源码安装Python3的前提条件
centos7源码安装Python3的前提条件: # yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline- ...
- Linux 源码安装apache 与常见错误解决
文档原位置 一.编译安装apache 1.解决依赖关系 httpd-2.4.4需要较新版本的apr和apr-util,因此需要事先对其进行升级. 升级方式有两种,一种是通过源代码编译安装,一种是直接升 ...
- 源码安装Apache,报错:Cannot use an external APR with the bundled APR-util
一般在第一次源码安装是没有问题的,在版本变化情况下在次源码安装可能会遇到此问题: apache2.0.x与apache2.2.x在apr有很大区别,前者为依赖公用apr,后者依赖于自身的apr.一般前 ...
- centos7源码安装mysql5.7.19
centos7源码包安装mysql5.7 5.7.20安装方法和5.7.19的一样. 1.安装前准备 清空环境.安装相应的软件包 1>关闭防火墙和SELinux 2>配置yum源(阿里云, ...
- Centos7源码安装mysql及读写分离,互为主从
Linux服务器 -源码安装mysql 及读写分离,互为主从 一.环境介绍: Linux版本: CentOS 7 64位 mysq版本: mysql-5.6.26 这是我安装时所使用的版本, ...
随机推荐
- POI读取格式化后的单元格数据
public static String getFormattedValue(Cell cell) { FormulaEvaluator evaluator = cell.getSheet().get ...
- kubernetes1.11.1 部署prometheus
部署前提:已经安装好了kubernetes的集群,版本是1.11.1,是用kubeadm部署的. 2台虚拟机:master:172.17.1.36 node1:172.17.1.40 pro ...
- 【线性代数】2-7:转置与变换(Transposes and Permutation)
title: [线性代数]2-7:转置与变换(Transposes and Permutation) toc: true categories: Mathematic Linear Algebra d ...
- 第02组团队Git现场编程实战
GitHub仓库地址 click here 1.组员职责分工 组员 职责分工 黄智.赵镇 百度地图API使用 潘松波.颜志鹏 写分别测评福州人均消费50以下,50-100.100-200.200以上最 ...
- hadoop HA+Federation(高可用联邦)搭建配置(一)
hadoop HA+Federation(高可用联邦)搭建配置(一) 标签(空格分隔): 未分类 介绍 hadoop 集群一共有4种部署模式,详见<hadoop 生态圈介绍>. HA联邦模 ...
- golang——写文件和读文件
之前聊过,操作文件——读写文件,直接调用接口即可. 如果是一直写入操作,写入操作一直进行的,免不了会有,有时一大批数据过来,有时没有一条数据. 鉴于此场景,选择用select....channel 的 ...
- logserver 日志服务项目发布
logserver是使用logback.light-4j.commons-exec等构建的简单日志服务,参考项目logbackserver和light4j,支持跟踪日志.分页查看.搜索定位.下载文件等 ...
- TIZ_c 第0周总结(2019/10/15-2019/10/22)工欲善其事必先利其器
TIZ_c 第0周总结(2019/10/15-2019/10/22)工欲善其事必先利其器 任务清单 给自己取一个酷酷的id,并选择1-2个喜欢的方向.(只是初步选择,后期可更改) 改下群名片.例如yo ...
- mysql数据库——特殊sql语句整理之修改表结构
建表 先讲一下常规建表: CREATE TABLE testCreate ( id ) NOT NULL auto_increment, time ) NOT NULL, type ) NOT NUL ...
- vue active样式显示
html:代码 <ul> <li @click="current='xxxx'" :class="{active:current=='xxxx'}&qu ...