CentOS6.3 installation Lnmp

Source: Internet
Author: User

LAMP is a classic Web site architecture, each software has its own unique side, their duties, is simply "gold partner", very popular. Over time, even if the design is good, you will encounter bottlenecks.

In addition to optimizing the operating system, we look at other aspects of lamp optimization.

1, Nginx replacement Apache, to provide a better overall performance;

2, varnish, static file cache system, decomposition of HTTP static file pressure;

3, PHP-FPM replacement mod_php to provide better performance;

4. Php-eaccelerator or PHP-PECL-APC provides caching for PHP dynamic explanatory language;

5, memcache or Redis provide database cache for MySQL;

Due to hard drive development seriously retarded, and memory not only more and more fast, large capacity memory is also more and more inexpensive, so the current solution is to hit the memory idea, with the popularity of 64-bit operating system, God horse 4g,8g is no longer a dream, 16G, 32G of memory machines everywhere.

Download from: http://www.linuxidc.com/Linux/2013-04/82069.htm

MySQL 5.6 strong release, in addition to the new features, performance compared to MySQL 5.5 has been greatly improved, about 200%, the default parameters have changed.

Related reading:

MySQL Performance comparison test: MySQL 5.6 ga-vs-mysql 5.5 http://www.linuxidc.com/Linux/2013-04/82070.htm

MySQL 5.5 and 5.6 default parameter values differ http://www.linuxidc.com/Linux/2013-04/82071.htm

The installation was successful with yum+ rpm LNMP

The latest version of Nginx installation website.

#cat/etc/yum.repos.d/nginx.repo
[Nginx]
Name=nginx Repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
Gpgcheck=0
Enabled=1

#yum Install Nginx

Although CentOS 6.3 is already available through CR for the php-fpm of the official warehouse, the 5.3 version is too old.

php5.4 more php5.3 performance also has a great boost (here is a simple example), here choose Ius (Remi version I did not test success), also can yum get

RPM-IVH http://mirrors.ustc.edu.cn/epel/6/x86_64/epel-release-6-8.noarch.rpm
RPM-IVH http://dl.iuscommunity.org/pub/ius/stable/RedHat/6/SRPMS/ius-release-1.0-10.ius.el6.src.rpm

Yum install php54-cli php54-fpm php54-gd php54-mbstring php54-mcrypt php54-pdo php54-xml php54-xmlrpc

There is no php54-mysql installed on it.

Download the following MySQL software package, click here, or the official website,

mysql-client-5.6.10-1.el6.x86_64.rpm

mysql-server-5.6.10-1.el6.x86_64.rpm

mysql-shared-compat-5.6.10-1.el6.x86_64.rpm

Install MySQL 5.6 (if you are prompted for a dependent package, such as Libaio, you need to install the dependency package first)

RPM-UVH mysql-client-5.6.10-1.el6.x86_64.rpm mysql-server-5.6.10-1.el6.x86_64.rpm mysql-shared-compat-5.6.10-1.el6.x86_64.rpm

Start MySQL

Service MySQL Start

MySQL 5.6 Default root password is random, first must be modified, the random password in the file/root/.mysql_secret, the first time must change the password, otherwise MySQL is not available.

Mysqladmin-u root-p ' oldpass ' password ' newpass '
History-c

This modification will have the plaintext password recorded in the Shell's history command, need to clear, the other way is to enter the MySQL password change, not detailed.

Because the Mysql-libs package and the mysql-server-5.6.10-1.el6.x86_64.rpm version conflict, if you have already installed,

Need to be forced to uninstall beforehand

01.RPM-E Mysql-libs--nodeps

Install Php54-mysql, this installation step must be put in the last

01.yum Install Php54-mysql

Otherwise, the PHP-FPM can not be started, the following error may occur roughly

[[Email protected] ~]# service PHP-FPM start
Starting php-fpm: [26-may-2018 10:27:53] notice:php message:php warning:php startup:unable to load Dynamic library '/U Sr/lib64/php/modules/mysql.so '-Libmysqlclient.so.16:cannot open Shared object file:no such file or directory in Unknow N On line 0
[26-may-2018 10:27:53] notice:php message:php warning:php startup:unable to load Dynamic Library '/usr/lib64/php/modules/mysqli.so '-libmysq Lclient.so.16:cannot open Shared object file:no such file or directory in Unknown on line 0
[26-may-2018 10:27:53] notice:php message:php warning:php startup:unable to load Dynamic Library '/usr/lib64/php/modules/pdo_mysql.so '-libm Ysqlclient.so.16:cannot open Shared object file:no such file or directory in Unknown on line 0

In addition, PHP-FPM runs as Apache by default, you may need to install httpd first and then uninstall HTTPD so that the system will leave a blank Apache user for php-fpm use.

Start PHP-FPM, if there is no error, it means no problem,

LNMP configuration process, click here http://www.linuxidc.com/Linux/2013-05/84882.htm

PHP code to test MySQL connection,

<?php
$link =mysql_connect (' localhost ', ' root ', ' passwd ');
if (! $link) echo "link error!";
else echo "link is ok!";
Mysql_close ();
?>

CentOS6.3 installation Lnmp

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.