L:Linux
A:Apache
M:MySQL、MariaDB
P:PHP、Python
yum搭建LAMP
关闭防火墙、selinux
搭建yum仓库
安装
yum -y install httpd php-fpm php-mysql mariadb-server
启动服务并设置开机自启
systemctl start httpd php-fpm mariadb
systemctl enable httpd php-fpm mariadb
设置php-fpm模块配置
httpd -M |grep fcgi(查看php-fpm模块是否开启,默认开启,没有开启则开启之)
vim /etc/httpd/conf.d/fcgi.conf
完成,测试php
创建测试动态页面
访问成功
源码编译搭建LAMP
一、环境准备
关闭防火墙、selinux
centos7.4
Apache
php-fpm
centos7.4
MariaDB
需要的相关包组
apr-1.6.3.tar.gz
apr-util-1.6.1.tar.gz
Discuz_X3.2_SC_UTF8.zip
httpd-2.4.33.tar.bz2
php-7.1.18.tar.bz2
wordpress-4.9.4-zh_CN.tar.gz
二、二进制编译安装MariaDB
详细步骤请查看之前的博客——(飞机票:http://blog.youkuaiyun.com/qq_35242906/article/details/80581631)
这里我就不浪费时间了,直接脚本安装了
脚本内容:(写路径时不要写最后的"/"。脚本功底不好,大佬勿怪。)
创建表,创建用户
mysql
create database wpdb;
grant all on wpdb.* to wpuser@'192.168.30.%' identified by '111111';
flush privileges;
数据库安装完成
三、源码搭建Apache服务
tar xf apr-1.6.3.tar.gz
tar xf apr-util-1.6.1.tar.gz
tar xf httpd-2.4.33.tar.bz2
mv apr-util-1.6.1 httpd-2.4.33/srclib/apr-util
mv apr-1.6.3 httpd-2.4.33/srclib/apr
yum安装依赖包组
yum -y groupinstall "development tools"
yum -y install pcre-devel openssl-devel expat-devel
编译
cd httpd-2.4.33/
./configure --prefix=/data/httpd24 \
--sysconfdir=/etc/httpd24 \
--enable-so --enable-ssl \
--enable-rewrite \
--with-zlib --with-pcre \
--with-incloded-apr \
--enable-modules=most \
--enable-mpms-shared=all \
--with-mpm=prefork
安装、配置环境变量
make && make install
echo PATH=/data/httpd24/bin:$PATH >/etc/profile.d/httpd.sh
. /etc/profile.d/httpd.sh
修改配置文件
开启php-fpm模块
添加index.php
添加到尾行就行
启动服务
验证
四、源码搭建php-fpm服务
yum安装相关依赖包组(epel源)
yum -y install libxml2-devel bzip2-devel libmcrypt-devel
解压编译
tar xf php-7.1.18.tar.bz2
cd php-7.1.18
./configure --prefix=/data/php \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-openssl \
--with-pdo-mysql=mysqlnd \
--enable-mbstring \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--enable-sockets \
--enable-fpm \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--enable-maintainer-zts \
--disable-fileinfo
安装
make && make install
在之前Apache的PATH变量中添加php的路径
准备配置文件
cp php.ini-production /etc/php.ini
准备启动脚本
cp sapi/fpm/init.d.php-fpm.in /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
更改配置文件名,使之生效,并启动服务
五、生成博客配置
在Apache上搭建博客测试
把博客解压到Apache的默认访问路径中
数据库信息更改为刚才配置的信息
验证