LNMP Environment Construction, LNMP building _php Tutorial

Source: Internet
Author: User
Tags automake

LNMP Environment Construction, LNMP construction


1. Check and install the components

Yum-y install gcc automake autoconf libtool make gcc-c++ glibc

2. Installation Library

Yum-y Install libxslt-devel \libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \zli b zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel \ncurses ncurses-devel Curl curl-devel e2fsprogs E2FSPR Ogs-devel \krb5-devel libidn libidn-devel OpenSSL openssl-devel

3, Installation Libmcrypt

Cd/usr/local/srcwget Ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gztar ZXVF LIBMCRYPT-2.5.7.TAR.GZCD libmcrypt-2.5.7./configure--prefix=/usr/local/libmcryptmake && make Installvi/etc /ld.so.conf.d/local.conf Add "/usr/local/libmcrypt/lib" ldconfig-v

4. Install PHP

wget Http://cn2.php.net/get/php-5.6.11.tar.gz/from/this/mirrortar zxvf php-5.6.11.tar.gzcd php-5.6.11./configure-- prefix=/usr/local/php  --enable-fpm--with-mcrypt=/usr/local/libmcrypt \--enable-mbstring--disable-pdo-- With-curl--disable-debug  --disable-rpath \--enable-inline-optimization--with-bz2  --with-zlib-- Enable-sockets \--enable-sysvsem--enable-sysvshm--enable-pcntl--enable-mbregex \--with-mhash--enable-zip-- With-pcre-regex--with-mysql--with-mysqli \--with-gd--with-jpeg-dir--with-opensslmake && make install

  

Installation succeeded:

 

Configure PHP-FPM

CD/USR/LOCAL/PHP/ETCCP php-fpm-default.conf php-fpm.conf

Modify php-fpm.conf

VI php-fpm.conf

  

Modify user = Nobody group = Nobody to user = Phpz Group = Phpz

Create user Phpz and user groups Phpz

Groupadd phpzuseradd-g Phpz Phpz

Create PHP.ini

Cp/usr/local/src/php-5.6.11/php.ini-production/usr/local/php/lib/php.ini

Set Php-fpm.pid

VI php-fpm.conf

  

Remove the semicolon from the front of the PID = Run/php-fpm.pid.

Note: Restart the php-fpm command: KILL-USR2 ' cat var/run/php-fpm.pid '

4. Installing Nginx

Cd/usr/local/src

Download and unzip pcre-8.36.tar.gz:

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz tar zxvf pcre-8.36.tar.gz

Download and unzip zlib-1.2.8.tar.gz:

wget Http://zlib.net/zlib-1.2.8.tar.gztar ZXVF zlib-1.2.8.tar.gz

Download and unzip openssl-1.0.1g.tar.gz:

wget Http://www.openssl.org/source/openssl-1.0.1g.tar.gztar ZXVF openssl-1.0.1g.tar.gz

Download and unzip nginx-1.4.7.tar.gz:

wget Http://nginx.org/download/nginx-1.4.7.tar.gztar ZXVF nginx-1.4.7.tar.gz

Installing Nginx

Vi/usr/bin/pod2man #注释第69行cd/usr/local/src/nginx-1.4.7./configure--prefix=/usr/local/nginx \--with-http_ssl_ Module \--with-pcre=/usr/local/src/pcre-8.36 \--with-zlib=/usr/local/src/zlib-1.2.8 \--with-openssl=/usr/local/ src/openssl-1.0.1g

Start Nginx

Cd/usr/local/nginx./sbin/nginx

Browser access: http://localhost

  

Configure nginx.conf, let nginx processing request through PHP fastcgi, first to Nginx installation directory Cd/usr/local/nginx, modify VI conf/nginx.conf file, find the following:

Uncomment, and then modify/scripts$fastcgi_script_name to $document _root$fastcgi_script_name

Create a new PHP file

Cd/usr/local/nginx/htmlvi index.php
 
  

Start PHP-FPM, restart Nginx

/usr/local/php/sbin/php-fpm/usr/local/nginx/sbin/nginx-s Reload

Browser Access http://127.0.0.1/index.php

5. Install MySQL

Download:

Cd/usr/local/srcwget http://mirrors.sohu.com/mysql/MySQL-Cluster-7.4/mysql-cluster-gpl-7.4.7.tar.gz

Install CMake First:

Yum-y Install CMake

To add a user and group named "mysql":

Groupadd mysqluseradd-r-G MySQL MySQL

Decompression mysql-cluster-gpl-7.4.7.tar.gz:

Tar zxvf mysql-cluster-gpl-7.4.7.tar.gz

The CMake command is as follows:

CMake \-dcmake_install_prefix=/usr/local/mysql \-ddefault_charset=utf8 \-ddefault_collation=utf8_general_ci \- dmysql_tcp_port=3306 \-dmysql_unix_addr=/usr/local/mysql/run/mysql.sock \-dwith_innobase_storage_engine=1 \-DWITH _ssl=yes

Install MySQL:

Make && make install
Installation takes a while, can have a cup of tea to initialize the database, switch directories to the MySQL installation directory first:
cd/usr/local/mysql/

Then change the user and group of all files in the installation directory to MySQL

Chown-r MySQL. chgrp-r MySQL.

Initialize the database:

./scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql

Then change the owning user of all files of the directory to "root", and then change the owning user of directory "data" to "mysql" (this step is important, otherwise the database may not operate on this directory):

Chown-r root. chown-r mysql datachown-r mysql data/mysqlchown-r mysql.mysql/usr/local/mysql/data

Copy the MySQL configuration file to the profile directory "/etc/", and ask if you want to overwrite the source file input "yes":

CP SUPPORT-FILES/MY-MEDIUM.CNF/ETC/MY.CNF
To set up MySQL I set myself to installation directory"run/" folder, so you have to set the folder's owning user to "mysql":
Chown-r MySQL./run

The next most iconic step is to run the MySQL daemon:

Bin/mysqld_safe--user=mysql &

Set the password for the "root" account in the MySQL database:

./bin/mysqladmin-u root password ' 123456 '

Use the "root" account to enter the MySQL management system:

./bin/mysql-u Root-p

Enter your password when prompted. The interface after entry should look something like this:

 

Congratulations, the LNMP environment has been successfully built.

Summarize:

Linux:centos-7-x86_64-dvd-1503-01.iso

Php:php-5.6.11.tar.gz

nginx:nginx-1.4.7

Mysql:mysql-cluster-gpl-7.4.7.tar.gz

If you have any questions, please ask in the comments.

If this article is helpful to you, please help yourself to "recommend".

Reprint please indicate the source (original URL):http://home.php-z.com/blog-1-39.html

http://www.bkjia.com/PHPjc/1040151.html www.bkjia.com true http://www.bkjia.com/PHPjc/1040151.html techarticle LNMP Environment Construction, LNMP build 1, check and install components yum-y install gcc automake autoconf libtool make gcc-c++ glibc 2, installation library yum-y install LIBXSLT -devel \libjpeg libjpeg-...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.