基于lamp(源码)搭建blog

lamp架构搭建blog(源码)

安装环境:2台主机,centos7.5

host1:192.168.67.115   httpd php

host2:192.168.67.111   mariadb

安装包:

apr-1.6.3.tar.gz

apr-util-1.6.1.tar.gz

httpd-2.4.33.tar.bz2

php-7.1.18.tar.bz2

mariadb-10.2.15-linux-x86_64.tar.gz

wordpress-4.9.4-zh_CN.tar.gz

 

  1. httpd编译安装

yum -y group install “Development tools”

yum -y install pcre-devel openssl-devel expat-devel

 

tar xvf apr-1.6.3.tar.gz

tar xvf apr-util-1.6.1.tar.gz

tar xvf httpd-2.4.33.tar.bz2

 

mv apr-1.6.3 httpd-2.4.33/srclib/apr

mv apr-util-1.6.1 httpd-2.4.33/srclib/apr-util

 

cd httpd-2.4.33/

./configure –prefix=/data/httpd24 \

–sysconfdir=/etc/httpd24 \

–enable-so \

–enable-ssl \

–enable-rewrite \

–with-zlib \

–with-pcre \

–with-included=apr \

–enable-modules=most \

–enable-mpms-shared=all \

–with-mpm=prefork

 

make -j 4 && make install

 

echo PATH=/data/httpd24/bin:$PATH > /etc/profile.d/lamp.sh

apachectl start

 

配置httpd支持php

vim /etc/httpd24/httpd.conf

取消注释

图片2图片1

 

添加以下四行

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

ProxyRequests Off

ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/app/httpd24/htdocs/$1

 

停止和启动服务

apachectl stop

apachectl start

 

 

  1. php编辑安装

yum -y install libxml2-devel bzip2-devel libmcrypt-devel

tar xvf php-7.1.7.tar.bz2

cd php-7.1.7/

./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

 

vim /etc/profile.d/lamp.sh

图片3

. /etc/profile.d/lamp.sh

cd php-7.1.18/

cp php.ini-production /etc/php.ini              配置文件

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm   服务脚本

chmod +x /etc/init.d/php-fpm

 

chkconfig –add php-fpm

chkconfig php-fpm on

 

cd /data/php/etc

cp php-fpm.conf.default php-fpm.conf

cd php-fpm.d/

cp www.conf.default www.conf

 

  1. host2:二进制安装Mariadb

useradd -r -s /sbin/nologin mysql

tar xvf mariadb-10.2.15-linux-x86_64.tar.gz -C /usr/local/

cd /usr/local/

chown -R mysql.mysql mysql

echo PATH=/usr/local/mysql/bin:$PATH > /etc/profile.d/lamp.sh

. /etc/profile.d/lamp.sh

./scripts/mysql_install_db –datadir=/data/mysqldb –user=mysql

cp support-files/my-huge.cnf /etc/my.cnf

cp support-files/mysql.server /etc/init.d/mysqld

[mysqld]

datadir         = /data/mysqldb

 

chkconfig –add mysqld

service mysqld start

 

MariaDB [(none)]> grant all on wpdb.* to wpuser@’192.168.67.%’ identified by “aa12345”;

MariaDB [(none)]> create database wpdb;

MariaDB [(none)]> flush privileges;

 

 

 

  1. 安装wordpress

tar xvf wordpress-4.9.4-zh_CN.tar.gz

mv wordpress/* /data/httpd24/htdocs/

cp wp-config-sample.php wp-config.php

vim wp-config.php

图片4

 

  1. 测试,在浏览器上输入地址168.67.115

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/102137

发表评论

登录后才能评论

This site uses Akismet to reduce spam. Learn how your comment data is processed.

联系我们

400-080-6560

在线咨询:点击这里给我发消息

邮件:1823388528@qq.com

工作时间:周一至周五,9:30-18:30,节假日同时也值班