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 这是我安装时所使用的版本, ...
随机推荐
- Python2.x与3.x版本区别Ⅱ
除法运算 Python中的除法较其它语言显得非常高端,有套很复杂的规则.Python中的除法有两个运算符,/和// 首先来说/除法: 在python 2.x中/除法就跟我们熟https://www.x ...
- CPU内部结构图
原文地址:http://blog.csdn.net/jiuyueguang/article/details/9350793
- Bert系列 源码解读 四 篇章
Bert系列(一)——demo运行 Bert系列(二)——模型主体源码解读 Bert系列(三)——源码解读之Pre-trainBert系列(四)——源码解读之Fine-tune 转载自: https: ...
- 使用已有的jmeter测试结果日志文件生成html报告
当并发数较大的时候,经常会出现测试结束后没有生成html报告的情况 解决办法: 测试结束后,使用生成的jmeter测试结果日志文件.jtl生成html报告 基本命令格式: jmeter -g < ...
- C# Unicode编码解码
public static class CommpnHelpEx { /// <summary> /// unicode编码 /// </summary> /// <pa ...
- 【记录】springboot项目的maven的pom.xml文件第一行报错 Unknown Error
原因 : maven的插件版本的问题,造成与IDE的不兼容 解决办法 :在pom中加上 <maven-jar-plugin.version>3.1.1</maven-jar-plug ...
- Linux编程之recvmsg和sendmsg函数
recvmsg 和 sendmsg 函数 #include <sys/types.h> #include <sys/socket.h> ssize_t send(int soc ...
- macos npm + node 环境启动问题排查
MacOS安装npm全局包的权限问题 解决办法:修改npm包所安装目录的权限:sudo chown -R $USER /usr/local 然后输入密码就可以了 deMBP:~ $ sudo ch ...
- arcgis python desc.dataType
desc = arcpy.Describe(r"C:\Users\dell\Documents\ArcGIS\ddd.shp") 是ShapeFile desc = arcpy.D ...
- CNN基础框架简介
卷积神经网络简介 卷积神经网络是多层感知机的变种,由生物学家休博尔和维瑟尔在早期关于猫视觉皮层的研究发展而来.视觉皮层的细胞存在一个复杂的构造,这些细胞对视觉输入空间的子区域非常敏感,我们称之为感受野 ...