Centos+nginx+php+mysql Standard production Environment configuration method _linux

Source: Internet
Author: User
Tags benchmark fpm gpg pear tidy centos vps epel repo

PHP 5.3.1

MySQL 5.0.89

Nginx 0.8.33 or 0.7.65 (optional)

This can be compared to what is circulated on the Internet a key installation package is much better, strongly recommend this method installation, suitable for all rookie and master. My server on the full use of the source code compiled installation, is not good where to go, but also very laborious. I've finished with some of the usual extensions for PHP, Pdo,eaccelerator,memcache,tidy and so on.

CentOS install, and create a new repo first

# Vi/etc/yum.repos.d/centos.21andy.com.repo

Put in the following content

[21andy.com]
name=21andy.com Packages for Enterprise Linux 5-$basearch
baseurl=http://www.21andy.com/centos/5/$basearch/
Enabled=1
Gpgcheck=0
Protect=1

Enable Epel Repo

CentOS i386 Enter the following command

RPM-IHV http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

CentOS x86_64 Enter the following command

RPM-IHV http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm

Then import key

RPM--import/etc/pki/rpm-gpg/rpm-gpg-key-epel

Copy Code

OK, one-click installation.

Yum-y install Nginx mysql-server php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml PHP-XM LRPC php-pear Php-pecl-memcache Php-eaccelerator

Last yum-y update, it's all up to date.

If nginx you want to use 0.7.65 's latest stable version,

Yum-y Install Nginx

Into

Yum-y Install Nginx-stable

It's okay.

You're ready to play like this when you're done.

Service mysqld Start

Service PHP-FPM Start

Service Nginx Start

Don't forget to set the boot up

Chkconfig--level 345 mysqld on

Chkconfig--level 345 php-fpm on

Chkconfig--level 345 Nginx on

The configuration files are under/etc, looking for themselves.

See how automatic the installation

Dependencies resolved

==========================================================
Package Arch Version Repository Size
==========================================================
Installing:
MySQL x86_64 5.0.89-1.el5 21andy.com 3.5 M
Mysql-server x86_64 5.0.89-1.el5 21andy.com M
Nginx x86_64 0.8.33-3.el5 21andy.com 422 k
PHP-CLI x86_64 5.3.1-2.el5 21andy.com 2.4 M
Php-eaccelerator x86_64 2:0.9.6-1.el5 21andy.com 118 k
PHP-FPM x86_64 5.3.1-2.el5 21andy.com 1.2 M
PHP-GD x86_64 5.3.1-2.el5 21andy.com k
Php-mbstring x86_64 5.3.1-2.el5 21andy.com 1.1 M
Php-mcrypt x86_64 5.3.1-2.el5 21andy.com k
Php-mysql x86_64 5.3.1-2.el5 21andy.com k
Php-pdo x86_64 5.3.1-2.el5 21andy.com-K
Php-pear Noarch 1:1.9.0-1.el5 21andy.com 420 k
Php-pecl-memcache x86_64 2.2.5-3.el5 21andy.com k
Php-tidy x86_64 5.3.1-2.el5 21andy.com k
Php-xml x86_64 5.3.1-2.el5 21andy.com k
Php-xmlrpc x86_64 5.3.1-2.el5 21andy.com k
Installing for dependencies:
GMP x86_64 4.1.4-10.EL5 Base 201 k
Libxaw x86_64 1.0.2-8.1 Base 329 k
Libxmu x86_64 1.0.2-5 Base K
LIBXPM x86_64 3.5.5-3 Base K
Libedit x86_64 2.11-2.20080712cvs.el5 Epel k
Libmcrypt x86_64 2.5.8-4.el5.centos Extras k
Libtidy x86_64 0.99.0-14.20070615.el5 Epel 140 k
Php-common x86_64 5.3.1-2.el5 21andy.com 554 k
Sqlite2 x86_64 2.8.17-5.el5 21andy.com 165 k
T1lib x86_64 5.1.1-7.el5 Epel King
Updating for dependencies:
Libevent x86_64 1.4.12-1.el5 21andy.com 129 k

Transaction Summary
==========================================================
Install Package (s)
Update 1 Package (s)
Remove 0 Package (s)

The following tests my local virtual machine and VPS on the Nginx + PHP-FPM performance

My native virtual machine test, configured to PD930 dual-core 3.0g,2g memory, assigned to the virtual machine is 1G memory, installed system for CentOS 5.4 64bit

Test content is

<?php phpinfo ();? >

30% Concurrent test, the CPU utilization rate to the system, the load of about ten , the page open or fast

[Root@localhost ~]# webbench-c 500-t http://127.0.0.1/
Webbench-simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking:get HTTP://127.0.0.1/
Clients, running Sec.

speed=223504 pages/min, 21806556 bytes/sec.
requests:111752 susceed, 0 failed.

test concurrency, CPU utilization 35%, the system load around, the page open or fast

[Root@localhost ~]# webbench-c 2000-t http://127.0.0.1/
Webbench-simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking:get HTTP://127.0.0.1/
Clients, running Sec.

speed=429494 pages/min, 39004788 bytes/sec.
requests:214747 susceed, 0 failed.

5000 Concurrent testing, CPU utilization 30%, the system load to a , the page is also a good speed, read this data, the previous days that the 15 million PHP request is nothing

[Root@localhost ~]# webbench-c 5000-t http://127.0.0.1/
Webbench-simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking:get HTTP://127.0.0.1/
5000 clients, running Sec.

speed=788986 pages/min, 66952700 bytes/sec.
requests:394493 susceed, 0 failed.

Not yet, pervert. 10000 concurrent

10000 concurrency, CPU use or less than 30%, the system load from around 1000 has been up to about, dizzy dead! I can even open it! Just a little card! Load to more than when incredibly not card! Crazy, I This is still a virtual machine, webbench or on their own machine, sweat, too strong

[Root@localhost ~]# webbench-c 10000-t http://127.0.0.1/
Webbench-simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking:get HTTP://127.0.0.1/
10000 clients, running Sec.

speed=1513718 pages/min, -17973622 bytes/sec.
requests:756859 susceed, 0 failed.

And my VPS, 2G memory, 8 kernel CPU test, but I am not using the above Yum installation, but the full use of source code compiled installation, test results are as follows:

500 concurrency, CPU utilization 20%, load 2 or so

# webbench-c 500-t http://127.0.0.1/index.php
Webbench-simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking:get http://127.0.0.1/index.php
Clients, running Sec.

speed=120520 pages/min, -36244332 bytes/sec.
Requests:60260 susceed, 0 failed.

2000 concurrency, CPU utilization rate of about 20%, load about 2, nothing changes

webbench-c 2000-t http://127.0.0.1/index.php
Webbench-simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking:get http://127.0.0.1/index.php
Clients, running Sec.

speed=111454 pages/min, -44285944 bytes/sec.
requests:55727 susceed, 0 failed.

Open to 3000 concurrent is the same, but open the page to wait a few seconds, suddenly come out, indicating that I process less open, there is room.

Now I understand that the last few days that 15 million PHP request can also be stable access is what happened, haha, you just centos 5.4 64bit, and then press my Yum method above installation, also can withstand.

Related Article

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.