Lnmp stands for the website server architecture of nginx + MySQL + PHP in Linux. Linux is a general term for a type of UNIX computer operating system and is currently the most popular free operating system. Representative versions include Debian, centos, Ubuntu, fedora, and Gentoo. [1] nginx is a high-performance HTTP and reverse proxy server and an IMAP/POP3/SMTP proxy server. [2] MySQL is a small relational database management system. [3] PHP is an embedded HTML language and a scripting language that is executed on the server side to embed HTML documents. [3] [4] these four types of software are free software and combined to become a free and efficient website service system.
Installation environment
Operating System: centos 6.5 (64bit)
User: jipeng
PHP 5.5.13
Nginx 1.7.2
Libmcrypt-2.5.8
Install other yum
By default, nginx and PHP do not feel any difference. Many friends have built Apache + PHP. After compiling Apache + PHP, the module File is generated, while nginx + PhP requires PHP to generate executable files, therefore, FastCGI technology should be used to achieve integration of nginx and PHP, As long as FastCGI is enabled for installation. This time we install PHP not only use FastCGI, but also use the PHP-FPM such a stuff, PHP-FPM said White is a management FastCGI a manager, it as a PHP plug-in pure in, install PHP in the form of a patch to install the PHP-FPM to PhP to use the PHP-FPM, and PHP to be consistent with the PHP-FPM version, this is necessary, remember!
I. Compile and install PHP
# (First install the software package on which PHP depends)
Yum install libxml2-devel net-snmp-devel curl-devel libpng-devel FreeType-devel libjpeg-devel zlib-devel Gd-*-y
Sudo wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
Tar-zxvf libmcrypt-2.5.8.tar.gz-C/usr/src/
CD/usr/src/libmcrypt-2.5.8
Make & make install
Define database location
Sudo VI/etc/lD. So. conf Add/usr/local/lib to take effect command: sudo ldconfig
# Download and install php-5.5.13 this version comes with support for PHP-FPM
Wget http://cn2.php.net/distributions/php-5.5.13.tar.bz2
Tar jxvf php-5.5.13.tar.bz2-C/usr/src/
CD/usr/src/php-5.5.13
. /Configure -- prefix =/usr/local/PHP -- enable-FPM -- With-mcrypt -- With-zlib -- enable-mbstring -- disable-PDO -- With-curl -- disable-Debug -- enable-pic -- disable-rpath -- enable-inline-optimization -- with-bz2 -- With-XML -- With-zlib -- enable-sockets -- enable-sysvsem -- enable-sysvshm -- enable-pcntl -- enable-mbregex -- With-mhash -- enable-XSLT -- enable-memcache -- enable-zip -- With-PCRE-RegEx -- With-MySQL
A warning is displayed, which can be ignored.
Warning unrecognized options -- enable-FastCGI, -- enable-pic, -- With-XML,
Make
Make install
CP/usr/local/PHP/etc/php-fpm.conf.default/usr/local/PHP/etc/php-fpm.conf
2. Compile and install nginx
Yum install zlib-devel GCC gcc-C ++ OpenSSL-devel PCRE-devel-y
Wget http://nginx.org/download/nginx-1.7.2.tar.gz
Tar zxf nginx-1.7.2.tar.gz-C/usr/src/
CD/usr/src/nginx-1.7.2/
./Configure -- prefix =/usr/local/nginx
Make & make install
3. Modify the nginx configuration file to support PHP-FPM
After nginx is installed, change the nginx configuration file to nginx. conf.
The following configurations are added to the server segment:
# Pass the PHP scripts to FastCGI server listening on Fig: 9000
#
Location ~ \. Php $ {
Root HTML;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param script_filename $ document_root $ fastcgi_script_name;
Include fastcgi_params;
# If (! -E $ request_filename ){
# Rewrite ^ (. *) $/index. php? S =/$1 last; # rewrite Mode
# Rewrite ^ (. *) $/index. php/$1 last; # Choose one of the pathinfo Modes
#}
}
4. Create a PHP Test File
Create a PHP File
Create the index. php file in/usr/local/nginx/html and enter the following content:
<? Echo phpinfo () ;?>
5. Start the service
Start PHP-FPM and nginx
Sudo/usr/local/PHP/sbin/PHP-FPM
Sudo/usr/local/nginx
6. browser access
Access http: // your server IP Address/index. php, you can see the PHP information.
This article is from the "starting from scratch" blog. For more information, contact the author!
(Lnmp architecture) service setup instance