X. LNMP (PHP redis) WordPress Deployment

Source: Internet
Author: User
Tags fpm gmp mcrypt php redis

1. Installing dependent Packages

Yum install libxml2 libxml2-devel OpenSSL openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel LIBP ng libpng-devel freetype freetype-devel GMP gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-d Evel Gd-devel Zlib-devel MCrypt Mhash
cd/application/tools/
wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.15.tar.gz
Tar XF libiconv-1.15.tar.gz
CD libiconv-1.15
./configure--prefix=/usr/local/libiconv
Make
Make install

2.PHP7 Compiling and installing

cd/application/tools/
wget http://cn2.php.net/get/php-7.1.17.tar.gz/from/this/mirror
Tar XF php-7.1.17.tar.gz
CD php-7.1.17
./configure \
--prefix=/application/php-7.1.17 \
--with-mysqli= MYSQLND \
--with-pdo-mysql=mysqlnd \
--with-fpm-user=www \
--with-fpm-group=www \
-- WITH-CONFIG-FILE-PATH=/APPLICATION/PHP-7.1.17/ETC \
--with-config-file-scan-dir=/application/php-7.1.17/etc/ PHP.D \
--with-mcrypt=/usr/local/libmcrypt \
--with-png-dir=/usr/local/libpng \
--with-jpeg-dir \
-- With-freetype-dir \
--with-bz2 \
--with-curl \
--with-gd \
--with-mhash \
--with-openssl \
-- With-zlib \
--with-gettext \
--with-xmlrpc \
--enable-mysqlnd \
--enable-bcmath \
--enable-fpm \
- -enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-mbstring \
-- ENABLE-PCNTL \
--enable-soap \
--enable-sockets \
--enable-session \
--enable-zip

Make
Make install
Chown-r www.www/application/php-7.1.17
Ln-s/application/php-7.1.17/application/php
Chown-r www.www/application/php
CP Php.ini-production/application/php/etc/php.ini
Cd/application/php/etc
CP Php-fpm.conf.default php-fpm.conf
CD php-fpm.d/
CP Www.conf.default www.conf

3.redis expansion

cd/application/tools/
wget Https://codeload.github.com/phpredis/phpredis/zip/develop
Unzip develop
CD phpredis-develop/
/application/php/bin/phpize
./configure--with-php-config=/application/php/bin/php-config
Make && make install
Vim/application/php/etc/php.ini
Extension=redis.so

4.nginx-phpfpm

Worker_processes 1;
Events {
Worker_connections 1024;
}
HTTP {
Include Mime.types;
Default_type Application/octet-stream;
Sendfile on;
Keepalive_timeout 65;
server {
Listen 80;
server_name lhj.blog.com;
Location/{
root HTML;
Index index.php index.htm;
}

    location ~* \.(php|php5)$ {        root html/blog;        fastcgi_pass 127.0.0.1:9000;        fastcgi_index index.php;        include fastcgi.conf;       }    error_page   500 502 503 504  /50x.html;    location = /50x.html {        root   html;    }}

}

5. Access Testing

6.wordpress

cd/application/tools/
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz
Tar XF wordpress-4.9.4-zh_cn.tar.gz
Mkdir/application/nginx/html/blog
MV wordpress/application/nginx/html/blog/
Chown-r www.www/application/nginx/html/blog
Cd/application/nginx/html/blog
mv wordpress/*./

Modify Mycat Settings
Vim/application/mycat/conf/schema.xml
<mycat:schema xmlns:mycat= "http://io.mycat/" >
<!--define logical libraries and logical tables for MYCAT instances-->
<schema name= "WordPress" Checksqlschema= "false" sqlmaxlimit= "100" Datanode= "Dn_test" > </schema>
<!--define the real host of all DataNode mentioned in the Mycat logical table, and the dataNode of the real database to which it belongs;
<datanode name= "Dn_test" datahost= "dn85" database= "WordPress"/>
<!--defines the number of DataNode connection restrictions mentioned Datahost, Load balancing orientation, as well as real read/write addresses (Writehost and Readhost)-->
<!--balance attribute load Balancing type, currently has 3 kinds of-->
<!--balance= "0", All read operations are sent to the currently available writehost-->
<!--balance= "1", all reads are sent randomly to Readhost-->,
<!--balance= "2", All read operations are randomly distributed on writehost, Readhost,-->

    &lt;!    --writetype Property Load Balancing type, there are currently 3 kinds of values--&gt; &lt;!    --writetype= "0", all write operations are sent to the available writehost--&gt; &lt;!    --writetype= "1", all write operations are sent randomly to readhost--&gt; &lt;!    --writetype= "2", all write operations are randomly writehost, readhost points on the hair--&gt; &lt;!    --switchtype= " -1,1,2,3" Enable master-slave switching--&gt; &lt;!    --switchtype= '-1 ' means no automatic switching--&gt; &lt;!    --switchtype= ' 1 ' default value, which means automatic switchover--&gt; &lt;!    --switchtype= ' 2 ' is based on the state of MySQL master-slave synchronization to determine whether to switch, heartbeat statement for show slave status--&gt; &lt;!    --switchtype= ' 3 ' switching mechanism based on MySQL galary cluster (for cluster) (1.4.1), heartbeat statement for show status like ' wsrep% '--&gt; &lt;datahost name= "Dn85" maxcon= "$" mincon= "3" balance= "1" writetype= "0" dbtype= "MySQL" dbdriver= "native" SWITC    Htype= "-1" slavethreshold= "&gt;" &lt;!            --Real read and write address--&gt;            &lt;heartbeat&gt;select User () &lt;/heartbeat&gt;                    &lt;writehost host= "200_m" url= "172.16.1.200:3306" user= "WordPress" password= "123456" &gt; &Lt;readhost host= "105_s1" url= "172.16.1.105:3306" user= "WordPress" password= "123456"/&gt;    &lt;/writeHost&gt; &lt;/dataHost&gt;

</mycat:schema>

Vim/application/mycat/conf/server.xml
<user name= "WordPress" >
<property name= "Password" >123456</property>
<property name= "Schemas" >wordpress</property>
</user>

Creating users and libraries in the database
Create user [email protected] '% ' identified by ' 123456 ';
Create database WordPress char set UTF8;
Grant all on wordpress.* to [email protected] '% ';
Flush privileges;
/application/mycat/bin/mycat stop
/application/mycat/bin/mycat start

nginx.conf modification
Location ~*. (PHP|PHP5) $ {
Root Html/blog;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Include fastcgi.conf;
}

7. Web Access Installation

X. LNMP (PHP redis) WordPress Deployment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.