LAMP实现编译安装FPM模式wordpress

LAMP

Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台。随着开源潮流的蓬勃发展,开放源代码的LAMP已经与J2EE和.Net商业软件形成三足鼎立之势,并且该软件开发的项目在软件方面的投资成本较低,因此受到整个IT界的关注。从网站的流量上来说,70%以上的访问流量是LAMP来提供的,LAMP是最强大的网站解决方案.

WordPress是一种使用PHP语言开发的博客平台,用户可以在支持PHP和MySQL数据库的服务器上架设属于自己的网站。也可把WordPress当作一个内容管理系统(CMS)来使用

下面是编译安装Linux+Apache+MariaDB+PHP实现wordpress

准备安装包六个:

下载地址

[root@centos7 ]#mkdir src  //创建src目录
[root@centos7 src]#mv *.bz2 *.gz src/  //把下载的安装包放到src里面
[root@centos7 src]#ls
apr-1.6.3.tar.bz2       
httpd-2.4.29.tar.bz2                 
php-7.2.1.tar.bz2
apr-util-1.6.1.tar.bz2  
mariadb-10.2.12-linux-x86_64.tar.gz  
wordpress-4.9.1-zh_CN.tar.gz

安装开发包组等
[root@centos7 src]#yum install pcre-devel openssl-devel expat-devel
[root@centos7 src]#yum groupinstall "development tools"

解压缩等
[root@centos7 src]#tar xvf apr-1.6.3.tar.bz2 
[root@centos7 src]#tar xvf apr-util-1.6.1.tar.bz2
[root@centos7 src]#tar xvf httpd-2.4.29.tar.bz2

[root@centos7 src]#mv apr-1.6.3 httpd-2.4.29/srclib/apr
[root@centos7 src]#mv apr-util-1.6.1 httpd-2.4.29/srclib/apr-util
httpd
[root@centos7 src]#cd httpd-2.4.29
[root@centos7 httpd-2.4.29]#./configure --prefix=/app/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
[root@centos7 httpd-2.4.29]#make -j 2 && make install

添加PATH变量(httpd mysql)
[root@centos7 ]#echo 'PATH=/app/httpd24/bin:/usr/local/mysql/bin:$PATH' > /etc/profile.d/lamp.sh
[root@centos7 ]#. /etc/profile.d/lamp.sh

修改httpd默认启动用户daemon改为apache
[root@centos7 support-files]#vim /app/httpd24/conf/httpd.conf
    User apache  //170行处
    Group apache
[root@centos7 support-files]#useradd -r -s /sbin/nologin apache //创建apache 系统用户

修改配置文件
[root@centos7 support-files]#vim /app/httpd24/conf/httpd.conf
    取消下面里那个so文件的注释
    LoadModule proxy_module modules/mod_proxy.so  119行
    LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so  123行

    定位至DirectoryIndexindex.html 修改为:
    DirectoryIndex index.php index.html  256行

    最后位置添加下面四行
    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

启动httpd
[root@centos7 httpd-2.4.29]#apachectl start
mariadb
解压缩、创建软连接
[root@centos7 src]#tar xvf mariadb-10.2.12-linux-x86_64.tar.gz -C /usr/local/
[root@centos7 src]#cd /usr/local/
[root@centos7 local]#ln -s mariadb-10.2.12-linux-x86_64/ mysql

创建mysql系统用户 和数据库目录
[root@centos7 local]#getent passwd mysql 
[root@centos7 local]#useradd -r -s /sbin/nologin mysql
[root@centos7 ]#mkdir /data/mysqldb -pv
[root@centos7 ]#chown -R mysql.mysql /data/mysqldb/

开始编译
[root@centos7 local]#cd mysql/
[root@centos7 mysql]#./scripts/mysql_install_db --datadir=/data/mysqldb --user=mysql
[root@centos7 mysql]#./bin/mysql_secure_installation  //提高mysql库的安全

准备配置文件
[root@centos7 mysql]#cd support-files/
[root@centos7 support-files]#cp my-huge.cnf /etc/my.cnf
[root@centos7 support-files]#vim /etc/my.cnf
    [mysqld]
    datadir=/data/mysqldb //在28行出添加数据库路径
    port            = 3306
    socket          = /tmp/mysql.sock
[root@centos7 support-files]#cp mysql.server /etc/init.d/mysqld
[root@centos7 support-files]#chkconfig --add mysqld
[root@centos7 support-files]#chkconfig --list |grep mysqld
    mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@centos7 support-files]#systemctl start mysqld
php
[root@centos7 ]#cd src/
[root@centos7 src]#tar xvf php-7.2.1.tar.bz2 
[root@centos7 src]#cd php-7.2.1
[root@centos7 php-7.2.1]#yum install libxml2-devel  bzip2-devel libmcrypt-devel  //libmcrypt-devel(epel源)
[root@centos7 php-7.2.1]#./configure --prefix=/app/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
[root@centos7 php-7.2.1]#make -j 1 && make install
[root@centos7 php-7.2.1]#cp php.ini-production /etc/php.ini
[root@centos7 php-7.2.1]#cp sapi/fpm/init.d.php-fpm /etc/init.d/fpm
[root@centos7 php-7.2.1]#ll /etc/init.d/fpm
    -rw-r--r-- 1 root root 2395 Jan 30 10:36 /etc/init.d/fpm
[root@centos7 php-7.2.1]#chmod +x /etc/init.d/fpm

[root@centos7 php-7.2.1]#chkconfig --add fpm
[root@centos7 php-7.2.1]#chkconfig --list |grep fpm
    fpm             0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@centos7 php-7.2.1]#cd /app/php/etc/
[root@centos7 etc]#cp php-fpm.conf.default php-fpm.conf
[root@centos7 etc]#cp php-fpm.d/www.conf.default php-fpm.d/www.conf
[root@centos7 etc]#systemctl start fpm
[root@centos7 etc]#apachectl restart
测试
[root@centos7 etc]#vim /app/httpd24/htdocs/info.php 
    <?php
    phpinfo();
    ?>

打开网页 IP地址/info.php


描述

wordpress
[root@centos7 etc]#cd /root/src/
[root@centos7 src]#tar xvf wordpress-4.9.1-zh_CN.tar.gz -C /app/httpd24/htdocs/
[root@centos7 src]#cd /app/httpd24/htdocs/
[root@centos7 htdocs]#mv wordpress/ blog

[root@centos7 htdocs]#cd blog
[root@centos7 blog]#cp wp-config-sample.php wp-config.php
[root@centos7 blog]#vim wp-config.php
    /** WordPress数据库的名称 */
    define('DB_NAME', 'blogdb');

    /** MySQL数据库用户名 */
    define('DB_USER', 'bloguser');

    /** MySQL数据库密码 */
    define('DB_PASSWORD', 'xxxxxx');

    /** MySQL主机 */
    define('DB_HOST', 'localhost');
连接数据库
[root@centos7 blog]#mysql
······
MariaDB [(none)]> create database blogdb; //创建数据库
MariaDB [(none)]> grant all on blogdb.* to bloguser@'localhost' identified by 'xxxxxx'; 建立用户 本机
MariaDB [(none)]> flush privileges;  更新
MariaDB [(none)]> quit;

打开网页 IP地址/blog 出现站点信息 LAMP实现编译安装FPM模式wordpress完成
之后你可以测试你的网站ab命令 ab命令详情

ab  -c 20 -n 100 http://[ip地址]/blog/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值