lamp=linux+apache+mysql+php; lnmp=linux+nginx+mysql+php their differences between Apache and Nginx and PHP in a different mode, we are talking about the two architectures, PHP in the form of a module and Apache as a whole, In this case we can remove the PHP installation directory/usr/local/php. and PHP in the LNMP started a service php-fpm, this mode is equivalent to the Nginx processing PHP script, directly forwarded the request to the PHP-FPM, plainly is a proxy. This PHP installation directory is not to be deleted. These two modes can be co-exist, and when compiling the configuration, change the directory behind the prefix= to allow it to be overwritten.
1.Mysql installation (5.6 will be lazy pack, so the installation process will have to install according to lazy bag)
Mysql5.6.29tar.gz Package This time using the source code compilation (but the work is not recommended to compile with the source code, too wasted time, or the use of binary source package installation is better)
First download the package and copy the package to/USR/LOCAL/SRC
Then unpack the package
CMake \
-dcmake_install_prefix=/usr/local/mysql \ (Installation path)
-dmysql_unix_addr=/usr/local/mysql/data/mysql.sock \ (socket file)
-ddefault_charset=utf8 \ (default character Set)
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \ (default encoding)
-DWITH_EXTRA_CHARSETS=UTF8,GBK \ (Additional code)
-dwith_perfschema_storage_engine=1 \ (Enable Perfschema engine support )
-dwith_federated_stogage_engine=1 \ (start federate engine support )
-dwith_partition_storage_engine=1 \(start PARTITION engine support )
-dwith_archive_storage_engine=1 \ (Start Archive engine Support )
-dwith_readline=1 \ (using READLINE function)
-dmysql_datadir=/usr/local/mysql/data \ (Database Data directory)
-dmysql_tcp_port=3306 (TCP/IP port)
Useradd-s/sbin/nologin-m MySQL
Mkdi-p/data/mysql
./scripts/mysql_install_db--user=mysql--datadir=/data/mysql (DataDir storage data)
5.mysql configuration file in (/ETC/MY.CNF)
CD support-files/
CP my-large.cnf/etc/my.conf
VI my.conf
"Mysqld" is used to configure the MySQL service
Log-bin=mysql-bin (the update data will have the corresponding log)--. > master-Slave useful
CP Mysql.sever/etc/init.d/mysqld
Vi/etc/init.d/mysqld
Found it
Basedir=/usr/local/mysql
Datadir=/data/mysql
Chkconfig-add mysqld (Join system Services list)
Chkconfig mysqld on (boot start)
/etc/init.d/mysqld start
Ps-aux |grep MySQL
Netstart-lnp|grep MySQL
Install PHP (5.5.29)
CD php-5.5.29
Create related users
Useradd-s/sbin/nologin PHP-FPM
Configuring compilation parameters
./configure--prefix=/usr/local/php --with-config-file-path=/usr/ Local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt
--enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6
Make &make Install
CP php.ini-production/usr/local/php/etc/php.ini (copy config file)
CP sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm (copy startup script file)
chmod 755./ETC/INIT.D/PHP-FPM (permission to add x)
Chkconfig--add php-fpm (boot start)
Startup configuration file Php-fpm.conf
cd/usr/local/php/etc/
MV Php-fpm.default php-fpm.conf
Check if error:/usr/local/php/sbin/php -fpm-t
PHP.ini is a global configuration file for PHP, such as I want to configure the time zone, configure the Disable function.
php-fpm.conf is a dedicated configuration file for PHP-FPM, such as configuring the user to run the service, configuring the startup parameters, etc., we have a video.
php-fpm is a boot binary file.
Nginx Installation
Cd/usr/local/src
wget http://mirrors.sohu.com/nginx/nginx-1.9.9.tar.gz
Tar xvf nginx-1.9.9.tar.gz
CD nginx-1.9.9
./configure \
--prefix=/usr/local/nginx \
--with-pcre (Regular library)
Error Installing: Need to install a pcre-devel (Devel representative is the development needs of the package, the general lack of what package is to devel)
Make & make Install
echo $? (The result is that 0 means no error)
Cd/usr/local/nginx Generating 4 directories
Iptables-f (temporarily empty firewall)
/usr/local/nginx/sbin/nginx (enter start)
In the browser with IP access can be found:
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/82/9E/wKioL1ddFE6i_zr6AAA8ICHOYrU284.png-wh_500x0-wm_3 -wmp_4-s_613845079.png "title=" 1.png "alt=" Wkiol1ddfe6i_zr6aaa8ichoyru284.png-wh_50 "/>
LNMP Build Success!!!
Then configure it so that PHP can parse it.
Vim/usr/local/nginx/conf/nginx.conf (default configuration file)
Open PHP features and modify
/usr/local/nginx/sbin/nginx-s Reload (Reload)
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/82/A0/wKiom1ddE5WD3K0pAAAZYynBZtQ211.png-wh_500x0-wm_3 -wmp_4-s_3664472519.png "title=" 2.png "alt=" Wkiom1dde5wd3k0paaazyynbztq211.png-wh_50 "/>
Then take root and do the global setup.
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/82/9E/wKioL1ddFNvCNdtZAAAJvom5z54728.png-wh_500x0-wm_3 -wmp_4-s_3398400103.png "title=" 3.png "alt=" Wkiol1ddfnvcndtzaaajvom5z54728.png-wh_50 "/>
Then cd/usr/local/nginx/html
VI 2.php
<?php
echo "Test is resolved"
?>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/82/9E/wKioL1ddFQ7SNN9tAAAPvJUR-1w593.png-wh_500x0-wm_3 -wmp_4-s_2718716558.png "title=" 4.png "alt=" Wkiol1ddfq7snn9taaapvjur-1w593.png-wh_50 "/>
Description Lnmp can parse PHP, PHP can run in the LNMP environment
Construction of LNMP environment under Linux