Lnmmp Platform Construction

Source: Internet
Author: User
Topology 650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4A/43/wKiom1QkA2rD8fEsAAe8ZNeNTe0466.bmp "Title =" a.bmp "alt =" wkiom1qka2rd8fesaae8znente0466.bmp "/> 1) nginx and compilation and Installation

Refer to the basic nginx usage article and be sure to add it during compilation.

2) Compile and install mariadb
# Add User useradd-r MySQL # Install and provide profile and startup script tar xvf mariadb-10.0.10-linux-x86_64.tar.gz-C/usr/local/CD/usr/local/ln-s mariadb-10.0.10-linux-x86_64/mysqlmkdir/etc /mysqlscp support-files/my-large.cnf/etc/MySQL/My. cnfscp support-files/MySQL. server/etc/init. d/mysqld # change the directory permission chown-r nginx. mySQL. /* chown-r MySQL. mySQL DATA # initialize the database scripts/mysql_install_db # Start the service and provide mariadb [(none)]> grant all on *. * To 'test' @ '172. 16.21.% 'identified by '000000'; query OK, 0 rows affected (123456 Sec) mariadb [(none)]> flush privileges; query OK, 0 rows affected (0.05 Sec)


3) Compile and install PHP
# Resolve dependencies Yum install bzip2-devel libmcrypt-devel libcurl-devel # unzip and install phptar XF php-5.4.26.tar.bz2-C/usr/local/src/CD/usr/local/src/php-5.4.26 /. /configure -- prefix =/usr/local/PHP -- With-mysql = mysqlnd -- With-OpenSSL -- With-PDO-mysql = mysqlnd -- With-mysqli = mysqlnd -- enable-mbstring -- with-FreeType-dir -- With-JPEG-dir -- With-PNG-dir -- With-zlib -- With-libxml-Dir =/usr/local/libxml -- enable-XML -- enable -sockets -- enable-FPM -- With-mcrypt -- With-config-file-Path =/etc -- With-config-file-scan-Dir =/etc/PHP. D -- with-bz2make & make install # provide the script Startup File and configuration file CP/usr/local/PHP/etc/php-fpm.conf.default/usr/local/PHP/etc/php-fpm.confcp/usr/local /src/php-5.4.26/SAPI/FPM/init. d. php-FPM/etc/init. d/PHP-FPM # Start Service PHP-FPM startstarting PHP-FPM doness-tnl | grep 9000 listen 0 128 127.0.0.1: 9000 *:*


4) Provide xcache acceleration for PHP
[[email protected] ~]# tar xf xcache-3.1.0.tar.bz2 -C /usr/local/src[[email protected] ~]# cd /usr/local/src/xcache-3.1.0[[email protected] xcache-3.1.0]#  /usr/local/php/bin/phpize[[email protected] xcache-3.1.0]# ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config[[email protected] xcache-3.1.0]# make && make install[[email protected] xcache-3.1.0]# mkdir /etc/php.d[[email protected] xcache-3.1.0]# cp xcache.ini /etc/php.d/[[email protected] xcache-3.1.0]# service php-fpm restaret


5) Configure nginx as the PHP reverse proxy

Edit the nginx configuration file and enable the following options:

Index index. php index.html index.htm; # add index. phplocation ~ to the index option ~ \. Php $ {root HTML; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param script_filename/scripts $ fastcgi_script_name; Include fastcgi_params ;}

Edit the/etc/nginx/fastcgi_params File

[[Email protected] xcache-3.1.0] # Cat/etc/nginx/gateway_interface cgi/1.1; server_software nginx; descriquery_string $ QUERY_STRING; fastcgi_param request_method $ request_method; descricontent_type $ content_type; fastcgi_param content_length $ content_length; fastcgi_param script_filename $ document_root $ fastcgi_script_name; fastcgi_param script_name $ Response; Response request_uri $ request_uri; Response document_uri $ document_uri; Response document_root $ document_root; Response server_protocol $ server_protocol; Response response $ response; Response remote_port $ remote_port; Response server_addr $ server_addr; fastcgi_param server_port $ server_port; fastcgi_param SERVER_NAME $ SERVER_NAME; # provide the PHP test page [[ Email protected] HTML] # Cat index. php <? Phpphpinfo ();?> # Access test

650) This. width = 650; "Title =" wpsd3ae. TMP "border =" 0 "alt =" wpsd3ae. TMP "src =" http://img1.51cto.com/attachment/201409/25/6837943_1411645708jIiu.png "Height =" 396 "style =" border: 0px; padding-left: 0px; padding-Right: 0px; padding-top: 0px; background-image: none; "/>

# Xcache has been successfully installed

650) This. width = 650; "Title =" wpsd3bf. TMP "border =" 0 "alt =" wpsd3bf. TMP "src =" http://img1.51cto.com/attachment/201409/25/6837943_1411645710E93n.png "Height =" 257 "style =" border: 0px; padding-left: 0px; padding-Right: 0px; padding-top: 0px; background-image: none; "/>

 

6) install memcached
[[Email protected] ~] # Tar xvf memcached-1.4.15.tar.gz-C/usr/local/src/[email protected] ~] # Cd/usr/local/src/memcached-1.4.15 [[email protected] memcached-1.4.15] # lsaclocal. m4 copying memcached_dtrace.d solaris_priv.cassoc.c daemon. c memcached. h stats. cassoc. h depcomp memcached. spec stats. hauthors Doc missing tcache. c hash. C News testapp. ccache. h hash. h protocol_binary.h thread. cchangelog install-SH readme. MD timedrun. ccompile items. c sasl_defs.c trace. hconfig. guess items. h sasl_defs.h util. cconfig. h. in M4 scripts util. hconfig. sub makefile. am sizes. c version. m4configure makefile. in slabs. cconfigure. AC memcached. c slabs. H [[email protected] memcached-1.4.15] #. /configure -- prefix =/usr/local/memcached [[email protected] memcached-1.4.15] # Make & make install # configure [[email protected] memcached-1.4.15] # echo "Export path =/usr/local/memcached/bin: $ path ">/etc/profile. d/memcache. sh [[email protected] memcached-1.4.15] #. /etc/profile. d/memcache. sh [[email protected] memcached-1.4.15] # echo "manpath/usr/local/memcached/share/Man">/etc/man. config [[email protected] memcached-1.4.15] # ln-s include/memcached/usr/include/memcache [[email protected] memcached-1.4.15] # useradd-r memcached [[email protected] memcached-1.4.15] # memcached-u memcached


6) install the memached module for PHP
[[Email protected] PHP] # tar xf memcache-2.2.7.tgz-C/usr/local/src/[[email protected] PHP] # cd/usr/local/src/memcache-2.2.7 /[[ email protected] memcache-2.2.7] #/usr/local/PHP/bin/phpize locking ing: php api version: 20100412 Zend module api no: 20100525 Zend extension api no: 220100525 [[email protected] memcache-2.2.7] #. /configure -- With-PHP-Config =/usr/local/PHP/bin/PHP-config -- enable-memcac He # in the PHP configuration file PHP. add extension =/usr/local/PHP/lib/PHP/extensions/no-debug-non-zts-20100525/memcache. so # Add the test page memtest. PHP [[email protected] memcache-2.2.7] # Cat/usr/local/nginx/html/memtest. php <? PHP $ mem = new memcache; $ mem-> connect ("172.16.21.103", 11211) or die ("cocould not connect"); $ version = $ mem-> getversion (); echo "server's version :". $ version. "<br/> \ n"; $ mem-> set ('hellokey', 'Hello world', 0,600) or die ("failed to save data at the memcached server"); echo "store data in the cache (data will expire in 600 seconds) <br/> \ n "; $ get_result = $ mem-> get ('hellokey'); echo "$ get_result is from MEMC Ached server. ";?>


# The access result is as follows:

650) This. width = 650; "Title =" wpsd3c0. TMP "border =" 0 "alt =" wpsd3c0. TMP "src =" http://img1.51cto.com/attachment/201409/25/6837943_1411645712gOoM.png "Height =" 152 "style =" border: 0px; padding-left: 0px; padding-Right: 0px; padding-top: 0px; background-image: none; "/>

# View the following in memcached:

[[email protected] ~]# telnet 127.0.0.1 11211Trying 127.0.0.1...Connected to 127.0.0.1.Escape character is ‘^]‘.get hellokeyVALUE hellokey 0 11Hello WorldEND

At this time, our lnmmp 'has been set up

Lnmmp Platform Construction

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.