LEMP builds a high-performance WEB server (version 2)-Linux Enterprise Application-Linux server application information. The following is a detailed description. Author: NetSeek http://bbs.linuxtone.org (it o & M Expert Network | cluster architecture | Performance Tuning)
You are welcome to reprint the document. During reprinting, please be sure to mark the original source and author information of the article as hyperlinks and this statement.
Last Updated: 2008-06-23
Directory
Preface:
I. System Installation
1. system partition
2. system initialization script (disable unnecessary services as needed)
Ii. Compile and install the Basic Environment
1. Installation preparation
2. Compile and install the software package
3. Compile and install PHP and Nginx
1. PHP (Fastcgi) Compilation and Installation
2. Install Nginx
Iv. Nginx multi-VM configuration and basic optimization (to configure Discuz! Forum example)
1. Configure the Nginx virtual host (Anti-Leech and expires settings)
2. Set up a download site in Nginx to limit the concurrency and speed.
3. How to Implement Nginx Authentication
4. How to Implement Nginx directory list
5. Modify Nginx header to disguise the server
6. Reduce the size of nginx compiled files
7. Nginx log processing
5. Basic Security Settings
Vi. Appendix and related introductions
Preface:
This article introduces the whole process of building a high-performance WEB with Nginx Based on the step by step structure.
The production server runs stably for a month. Hope to help
More beginners can easily build high-performance WEB servers. Any problems with the operations mentioned in this article can be solved.
Go to the LinuxTone forum to discuss your questions. We will answer your questions as soon as possible.
Update related content.
System Environment:
CentOS 5.1 + nginx-0.6.31 + php-5.2.6 + memcache-2.2.3 + xcache-1.2.2 + mysql-5.0.51b
I. System Installation
1. system partition
/Boot around M
2 times the physical memory of SWAP (If your physical memory is larger than 4 GB, allocate 4 GB)
/Partition 15 ~ 20G
/Usr/local 20G (for software installation)
/All data space remaining
* The specific partition can be divided according to the relevant business. This document does not introduce the installation.
2. system initialization script (disable unnecessary services as needed)
# Vi init. sh
CODE: # welcome
Cat <EOF
+ -------------------------------------------------------------- +
| === Welcome to CentOS System init ==|
+ -------------- Http://www.linuxtone.org ------------------------ +
+ -------------------------------------------------------------- +
EOF
# Disable ipv6
Cat <EOF
+ -------------------------------------------------------------- +
| === Welcome to Disable IPV6 ==|
+ -------------------------------------------------------------- +
EOF
Echo "alias net-pf-10 off">/etc/modprobe. conf
Echo "alias ipv6 off">/etc/modprobe. conf
/Sbin/chkconfig -- level 35 ip6tables off
Echo "ipv6 is disabled! "
# Disable selinux
Sed-I '/SELINUX/s/enforcing/disabled/'/etc/selinux/config
Echo "selinux is disabled, you must reboot! "
# Vim
Sed-I "8 s/^/alias vi = 'vim '/"/root/. bashrc
Echo 'syntax on'>/root/. vimrc
# LANG = en
Sed-I-e's/^ LANG =. */LANG = "en"/'/etc/sysconfig/i18n
# Tunoff services
# -------------------------------------------------------------- +
Cat <EOF
+ -------------------------------------------------------------- +
| === Welcome to Tunoff services ===|
+ -------------------------------------------------------------- +
EOF
# -------------------------------------------------------------- +
For I in 'ls/etc/rc3.d/S *'
Do
CURSRV = 'echo $ I | cut-c 15 -'
Echo $ CURSRV
Case $ CURSRV in
Crond | irqbalance | microcode_ctl | network | random | sendmail | sshd | syslog | local | mysqld)
Echo "Base services, Skip! "
;;
*)
Echo "change $ CURSRV to off"
Chkconfig -- level 235 $ CURSRV off
Service $ CURSRV stop
;;
Esac
Done |