First, the preparation of LNMP environment before construction
LNMP is the Linux system nginx+mysql+php this site server architecture, so need to download mysql,php, and nginx three sets of software.
Mysql:
32-bit: http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz
64-bit: http://syslab.comsenz.com/downloads/linux/mysql-5.1.40-linux-x86_64-icc-glibc23.tar.gz
Php:http://cn2.php.net/distributions/php-5.3.28.tar.gz
Nginx:http://nginx.org/download/nginx-1.6.2.tar.gz
Software Image http://mirrors.sohu.com/
Turn off SELinux
Install library files
Yum-y install NTP make OpenSSL openssl-devel pcre pcre-devel libpng libpng-devel libtiff-devel libjpeg-6b libjpeg-devel-6 b freetype freetype-devel gd gd-devel fontconfig-devel zlib zlib-devel libevent-devel gcc gcc-c++ Flex Bison bzip2-devel L IBXPM libxpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake Screen sy Sstat compat-libstdc++-33 Curl Curl-devel
Second, the installation of MySQL
MySQL installation method and lamp in the same way as the MySQL installation, the specific method of operation please refer to Lamp environment construction: Address
Third, the installation of PHP
1. Compiling
[Email protected] php-5.4.22]#/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--wi Th-zlib-dir--with-mcrypt--enable-soap--enable-gd-native-ttf--enable-ftp--enable-mbstring--enable-exif- -disable-ipv6--with-curl
[[email protected] php-5.4.22]# make
[[email protected] php-5.4.22]# make install
2. Configuration
# Add user [[email protected] ~]# useradd-s/sbin/nologin php-fpm# copy php config file [[email protected] php]# cp/usr/local/src/php-5.3 .28/php.ini-production/usr/local/php/etc/php.ini# copy startup script [[email protected] src]# CP php-5.3.28/sapi/fpm/ Init.d.php-fpm/etc/init.d/php-fpm[[email protected] src]# chmod 755! $chmod 755/etc/init.d/php-fpm# Make a php-fpm configuration file [[ Email protected] php]# Cd/usr/local/php/etc/[[email protected] etc]# mv Php-fpm.conf.default php-fpm.conf# set boot up [[ Email protected] ~]# chkconfig--add php-fpm[[email protected] ~]# chkconfig php-fpm on[[email protected] ~]# service php- FPM startstarting php-fpm Done
Four, Nginx
# unpacking software [[email protected] src]# TAR-XVF nginx-1.6.2.tar.gz# into the directory, compile [[email protected] nginx-1.6.2]#./configure--prefix= /usr/local/nginx--with-pcre# Compile and install [[email protected] nginx-1.6.2]# Make[[email protected] nginx-1.6.2]# make install# start Nginx[[email protected] nginx-1.6.2]#/usr/local/nginx/sbin/nginx
Five, edit nginx boot script
Script Contents please view: Address
# Edit Startup script, add script [[email protected] ~]# vim/etc/init.d/nginx[[email protected] ~]# chmod +x/etc/init.d/nginx# added startup service [[Email Protected] ~]# chkconfig--add nginx[[email protected] ~]# chkconfig Nginx on# because it was started before, this restart is good [[email protected] ~]# Servi Ce nginx Restart stop nginx: [OK] is starting Nginx: Determine
VI. Edit NGINX Configuration
[[email protected] ~]# vim /usr/local/nginx/conf/nginx.conf finds the following paragraph, removing the comment "#" from the location ~ \.php$ { root html ; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; # Modifying Nginx monitoring directory fastcgi_param script_ filename /usr/local/nginx/html/$fastcgi _script_name; include fastcgi_params; }
Test Nginx in Browser
If you cannot access it, check the iptables and SELinux
Seven, test PHP
Adding PHP test files to the monitoring directory
[Email protected] ~]# vim/usr/local/nginx/html/phpinfo.php# Add the following content <?phpphpinfo (); >
To test in a browser,
This article is from the "topspeed_king" blog, make sure to keep this source http://mylinuxlife.blog.51cto.com/4706737/1650959
Linux Learning Notes-22nd Lesson-LNMP Environment Building (i.)