This article introduces to you the content is about the construction of LNMP Environment Building Tutorial, has a certain reference value, a friend in need can refer to.
One, in the Linux system Nginx installation process, first to http://nginx.org/download/this site to find the version you need to download, copy the download link address, here to nginx-1.6.2 for example, in the command line Input command:
CD/USR/LOCAL/SRC //Download the installation package to the/USR/LOCAL/SRC directory
wget http://nginx.org/download/nginx-1.6.2.tar.gz
After the download is complete, you will see a nginx-1.6.2.tar.gz installation package in the directory, unzip the installation package:
Tar zxvf nginx-1.6.2.tar.gz
After decompression, install the input command:
CD nginx-1.6.2 //switch to the extracted Nginx directory
./configure--prefix=/usr/local/nginx //install to/usr/local directory
My server reported an error while executing the above command:
The above error says the C compiler could not be found, then you can install a compiler, enter the command:
Yum-y install gcc gcc-c++ autoconf automake make
After execution, use the Install command./configure--prefix=/usr/local/nginx has not reported the above error, but also prompted a new error:
The HTTP rewrite module requires the Pcre library, which will install the Pcre library:
Yum Install Pcre
The input command actually prompts me that I have installed the Pcre library.
It's time to check to see if the Pcre-devel is installed and the same command is entered:
Yum Install Pcre-devel
Execute the command, sure enough is no devel, enter Y to continue the installation, complete the installation command again later:
./configure--prefix=/usr/local/nginx
The result backfired and reported a mistake:
HTTP gzip module requires Zlib library, but also missing library, install the above routine to go again, command:
Yum Install zlib
Prompt me to do ..., oh da, continue to command:
Yum Install Zlib-devel
The devel is missing again and the installation command is executed again after the installation is complete:
./configure--prefix=/usr/local/nginx
This time the installation is finished, it is twists:
Finally, execute the compile command:
Make && make install
Nginx is much smaller than Apache, so it takes a short time to compile. Switching to the/usr/local/nginx directory when the compilation is complete will see four directories:
Conf Primary placement configuration Files
HTML primarily places Web page files
Logs to place log files primarily
Sbin Main Binary Program
To start Nginx, you only need to enter the command:
./sbin/nginx
Note: If you have Apache installed in front of you, you may be able to report an error,
Nginx: [Emerg] bind () to 0.0.0.0:80 failed (98:address already on use)//This is because your 80 port is already occupied, when you start the Nginx conflict
NETSTAT-TUNLP //view running services or software
Locate the software or service that occupies port 80 to close it, and then enter the./sbin/nginx command, if the character is normal, it should have started normally.
Second, yum installs MySQL:
Yum install MySQL mysql-devel mysql-server
This is nothing to say, all the way y installation can
Third, install PHP:
First to the PHP website to find the required version to download the compressed package, here in php-5.6 version of the example upload to the server/usr/local/src/directory, enter the command line mode, enter the command:
Tar zxvf php-5.6.36.tar.gz
After the decompression to compile, compile the time need to add some support, such as MYSQLND, TTF, GD and so on:
./configure--prefix=/usr/local/php--with-mysql=mysqlnd--enable-mysqlnd--with-gd--enable-gd-native-ttf-- Enable-gd-jis-conv--ENABLE-FPM
Compile-time need to be aware that may prompt errors, such as missing some packages, such as the installation of the same as above nginx, such as I encountered errors found LIBXML2, direct command:
Yum Install LIBXML2
Tip me to do ... One more command:
Yum Install Libxml2-devel
Sure enough, the lack of devel, after the installation is completed again, do not forget:
Make && make install
After compiling, we will do some PHP configuration operations:
Cp/usr/local/src/php-5.6.36/php.ini-development php.ini-production
Cp/usr/local/src/php-5.6.36/php.ini-development./lib/php.ini
CP Etc/php-fpm.conf.default etc/php-fpm.conf
Here you have completed the LNMP, do not forget the cd/usr/local/php directory to start PHP:
./sbin/php-fpm
Netstat-tunlp