1024programmer Nginx CentOS system LNMP production environment configuration process

CentOS system LNMP production environment configuration process

CentOS minimal installation, and then create a new repo first

# vi /etc/yum.repos.d/centos.21andy.com.repo
Put 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
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-xmlrpc php-pear
php-pecl-memcache php-eaccelerator
Finally, run yum -y update, all are the latest
If you want to use the latest stable version of nginx 0.7.65, put
yum -y install nginx
Change to
yum -y install nginx-stable
That’s it
After installing, you can already play like this
service mysqld start
service php-fpm start
service nginx start
Don’t forget to set it to start at boot
chkconfig –level 345 mysqld on
chkconfig –level 345 php-fpm on
chkconfig –level 345 nginx on
The configuration files are all found under /etc
See how the installation is automatic
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 10 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 110 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 27 k
php-mysql x86_64 5.3.1-2.el5 21Andy.com 84 k
php-pdo x86_64 5.3.1-2.el5 21Andy.com 91 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 44 k
php-tidy x86_64 5.3.1-2.el5 21Andy.com 31 k
php-xml x86_64 5.3.1-2.el5 21Andy.com 115 k
php-xmlrpc x86_64 5.3.1-2.el5 21Andy.com 48 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 63 k
libXpm x86_64 3.5.5-3 base 44k
libedit x86_64 2.11-2.20080712cvs.el5 epel 80k
libmcrypt x86_64 2.5.8-4.el5.centos extras 105 k
libtidy x86_64 0.99.0-14.20070615.el5 epel 140k
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 208 k
Updating for dependencies:
libevent x86_64 1.4.12-1.el5 21Andy.com 129 k
Transaction Summary
==================================================== ========
Install 26 Package(s)
Update 1 Package(s)
Remove 0 Package(s)
The following test the performance of Nginx + php-fpm on my local virtual machine and VPS respectively
My local virtual machine test is configured as PD930 dual-core 3.0G, 2G memory, 1G memory is allocated to the virtual machine, and the installed system is CentOS 5.4
64bit
The test content is

In the 500 concurrent test, the CPU usage rate reached 30%, the system load was around 10, and the page opened quickly
[root@localhost ~]# webbench -c 500 -t
30 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/
500 clients, running 30 sec.
Speed=223504 pages/min, 21806556 bytes/sec.
Requests: 111752 succeeded, 0 failed.
2000 concurrent test, the CPU usage rate is 35%, the system load is around 18, and the page opens very quickly
[root@localhost ~]# webbench -c 2000 -t
30 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/
2000 clients, running 30 sec.
Speed=429494 pages/min, 39004788 bytes/sec.
Requests: 214747 succeeded, 0 failed.
5000
In the concurrent test, the CPU usage rate is 30%, the system load reaches 35, and the page playback speed is not bad. After reading this data, the 15 million PHP requests mentioned a few days ago are nothing.
[root@localhost ~]# webbench -c 5000 -t
30 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 30 sec.
Speed=788986 pages/min, 66952700 bytes/sec.
Requests: 394493 succeeded, 0 failed.
It’s not enough, let’s be abnormal, 10000 concurrent
10000
Concurrently, the CPU usage is still less than 30%, and the system load has risen from about 60 to about 1000, and we are sick! It can still be opened! Just a little stuck! When the load reaches more than 600, it does not freeze! Crazy, I’m still a virtual machine, webbench
It’s still on my own machine, sweat, it’s too strong
[root@localhost ~]# webbench -c 10000 -t
30 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 30 sec.
Speed=1513718 pages/min, -17973622 bytes/sec.
Requests: 756859 succeeded, 0 failed.
And my VPS, 2G memory, 8-core CPU test, but I did not use the above yum installation, but compiled and installed it with source code, the test results are as follows:
500 concurrency, CPU usage 20%, load about 2
# webbench -c 500 -t 30 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
500 clients, running 30 sec.
Speed=120520 pages/min, -36244332 bytes/sec.
Requests: 60260 succeeded, 0 failed.
2000 concurrency, CPU usage is about 20%, load is about 2, nothing changes
webbench -c 2000 -t 30 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
2000 clients, running 30 sec.
Speed=111454 pages/min, -44285944 bytes/sec.
Requests: 55727 succeeded, 0 failed.
The same is true for 3000 concurrency, but it takes a few seconds to open the page, and suddenly it comes out, indicating that I have fewer processes and there is still room.
Now I understand why the 15 million PHP requests can still be accessed stably a few days ago, haha, you only need CentOS 5.4 64bit, and then press my above yum
Method installation, also can withstand.

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/centos-system-lnmp-production-environment-configuration-process/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索