CentOS 7 source code compilation and installation of PHP5.6, Nginx1.7.9 and MySQL (establish LNMP environment)
CentOS 7 source code compilation and installation of PHP5.6, Nginx1.7.9 and MySQL (establish LNMP environment)
I want to build an lnmp backup server... Source code compilation and installation, various dependency packages tangled, so mariadb (mysql) is installed in yum, php5.6 and nginx1.7.9 are installed in source code... When running the./configure script, I forgot to enable curl and other common extensions. After installation, I went to the source code directory to compile the extensions and dynamically add extensions...
1. install mariadb (mysql) Service yum install mariadb-server mariadb-devel
Since mysql was acquired by Oracle, mysql has the risk of charging for the closed source. Therefore, mariadb, the mysql branch modified by the Community version, has been used to avoid this risk. Starting from centos7, all mysql from yum source is replaced with mariadb. Therefore, mariadb is a branch of mysql. However, it seems that some of google's databases have already been migrated to mariadb, so I really want to despise oracle, and oracle databases have made so much money, and I am still using the idea of mysql...
Ii. Compile and install php5.6 with source code
1. Download php5.6 wget http://cn2.php.net/distributions/php-5.6.5.tar.gz Tangle is, just installed centos 7 even wget all wood, so yum-y install wget and then download ,,,
2. Unzip tar-xvzf php-5.6.5.tar.gz into cd php-5.6.5
3. run. /configure script to enable the required extension modules and specify the php installation directory. /configure-enable-fpm-enable-mbstring-with-mysql = mysqlnd-with-mysqli = mysqlnd-with-pdo-mysql = mysqlnd
This step is critical. I forgot to specify the-prefix, which is installed on/usr/local/php by default, but it is more appropriate to specify it. Also, remember to install the mbstring and fpm extensions here, and forget the curl and intl (there is a stuff that uses the yii2 framework and needs to be introduced, however, if you forget it, it will also be related. At that time, you will compile the extension and install it dynamically. However, in order to smoothly output the phpinfo page and enable nginx to support php, you must add-enable-fpm. fpm is a script manager of php. It seems that it was earlier than php5.3, fpm is just a patch. You need to go to the patch directory to find him. After php5.3, it is said that it is correct, and php has already been integrated, not a third-party package. You only need to keep up with-enable-fpm after installation... Php links to mysql. This is also necessary.-with-mysql specifies the mysql header file. You can use whereis mysql to specify the mysql installation directory, but after php5.5, directly use the mysql driver mysqlnd provided by php to access the port. It is said that this driver is better than that written by mysql... Balabara... I have no experience with sites with high traffic ...................
Php5.6./configure
After the configuration is complete, if there is no error, you will see the successful information. Install the xxx-devel Development Kit and run./configure.
./Configure result
Then compile make. My server has GB of memory and dual-core cpu. It seems like it takes more than 10 minutes to compile.
After compilation, make install is installed...
Make install result
Make install
Run php-v to view the php version information. The latest php 5.6 version will be installed.
Okay, it's similar here, but there is also the php configuration file php. ini. Copy the configuration file template php. ini-development under the installation directory to the php Directory. For php installed in yum, php will find its own configuration file under/etc/php. ini. Where is the configuration file installed by the source code... Write a phpinfo () page and open the page. Search for php under ctrl + f in google chrome. ini will see where php is found. ini, and then cp this php. ini-development to this directory and renamed it php. ini. Of course, it seems that php. ini is generally in/etc/php. ini or/usr/local/lib/php. ini. If it is not correct, it is the most reliable solution.
To make nginx support for php, fastcgi is required to process pages related to php, and php requires the php-fpm component to support it. This is different from appache's support for php. The./configure-enable-fpm has been installed, so the fpm has been enabled. Of course, we also need to configure php-fpm, when installing php, has generated a configuration template for us, in/usr/local/etc/php-fpm.conf.default, as long as you copy this template and rename it to the php-fpm.conf to the port, go in and change daemonize to yes, then the running mode of the server starts. Then, compress whereis php-fpm, which is an executable file and runs php-fpm directly. Then, netstat-an | grep php-fpm is displayed, sure enough, port 9000 is listening.
Php-fpm listening
3. Compile and install nginx1.7.9 in source code
1. Download nginx latest wget http://nginx.org/download/nginx-1.7.9.tar.gz
2. Unzip & enter tar-xvzf nginx-1.7.9.tar.gz
Cd nginx-1.7.9
3. run. /configure script to specify the installation directory. /configure-sbin-path =/usr/local/nginx-conf-path =/usr/local/nginx. conf-pid-path =/usr/local/nginx. pid with-http_ssl_module
Nginx./configure
Nginx./configure result
Then the configuration is complete. If an error is reported, the dependency is generally not found. If there is anything missing, yum-y install xxx-devel. After installation, the port is opened. For the first time, I was prompted that I lacked pcre and introduced a module such as rewrite to support it, of course, you can add an option in configure. If without does not install the recommended modules in the system, you can skip this error and continue the installation. However, the official nginx modules installed by default are still installed. With this regular expression missing, nginx won't be able to match the file at the End of. php, and then it will be handed over to php-fpm for processing.
Then, compile make... The Tangle is that nginx will be automatically installed after make, without the need to make install.
Nginx
Nginx is successfully installed.
Now, we want to make nginx match. the file at the end of php is parsed by fastcgi and sent to php-fpm. After parsing, nginx is sent to the browser for display. /The nginx configuration file address has been specified during configure.
Modify the configuration: vim/usr/local/nginx. conf
About 64 lines. The template already supports the php-fpm configuration. Remove the # annotation and restart nginx.
Return to the/usr/local/nginx/html directory, compile a phpinfo () page, and access this page in the browser to view the php and nginx information:
Install the LAMP \ Vsftpd \ Webmin \ phpMyAdmin service and settings in Ubuntu 13.04
Build and install the LNMP production environment in CentOS 6.4
Practical Production Environment-LNMP architecture compilation and installation + SSL encryption implementation
LNMP full-featured compilation and installation for CentOS 6.3 notes
Install LNMP in CentOS 6.3 (PHP 5.4, MyySQL5.6)
Nginx startup failure occurs during LNMP deployment.
Ubuntu install Nginx php5-fpm MySQL (LNMP environment setup)