CentOS7 Build Nginx + PHP + MySQL

Source: Internet
Author: User

-------------------------------------------------------------------------------------

Nginx Installation Reference Address: http://www.cnblogs.com/farwish/p/3807289.html

PHP Source Installation:

1. Download the source package and unzip it:

wget http://cn2.php.net/distributions/php-5.6.3.tar.gztar zxvf php-5.6 . 3. Tar . GZ cd PHP-5.6. 3

2. Installation dependencies:

These dependencies are libxml, libpng, Libjpeg, Libmcrypt ... such as

Follow the prompts, such as: Yum install libxml2 press TAB to view all Libxml packages, I install Yum install libxml2-devel.i686 here, and then configure.

Note: Libmcrypt is not in the CentOS network Yum repository and needs to be downloaded by itself.

(I. Source code installation Method:

    CD /usr/local/src

wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz

< Span class= "PLN" > tar - ZXVF libmcrypt-2.5. 8.tar. GZ

< Span class= "PLN" >< Span class= "pun" > CD Span class= "pun" >/usr/local/ src/libmcrypt-2.5< Span class= "pun". 8

< Span class= "PLN" >< Span class= "pun" >< Span class= "pun" >< Span class= "pun" >< Span class= "PLN" >/configure --prefix< Span class= "pun" >=/usr/local

make && make install

< Span class= "PLN" >< Span class= "pun" >< Span class= "pun" >< Span class= "pun" >< Span class= "PLN" >< span class= "str" >

  two. Use a third-party yum source
Download:

 wget  http:// www.atomicorp.com/installers/atomic  sh ./atomic 

< Span class= "PLN" >< Span class= "pun" >< Span class= "pun" >< Span class= "pun" >< Span class= "PLN" >< span class= "str" > Yum command installation: /span>

Yum  Install  Php-mcrypt  libmcrypt  libmcrypt-devel

3. Configuration:

./configure--with-libdir=lib64--prefix=/data/apps/php--with-mysql=mysqlnd--with-mysqli=mysqlnd--with-pdo-mysql =mysqlnd--enable-inline-optimization--enable-fpm--with-gd--with-zlib--with-png-dir --with-jpeg-dir --enable-mbstring--with-iconv--enable-sockets--with-curl--with-mcrypt--with-openssl--enable-pcntl-- Enable-soap--ENABLE-DBA

4. Compile and install:

Make && make install

After the installation is complete, you will find that there is no PHP configuration file under/usr/local/php/etc, create a new one:

cd/usr/local/php/etc/cp php-fpm.conf.default php-/home/weichen/php-5.6. 3 CP Php.ini-production/usr/local/php/etc/php.ini

5. Start PHP:
/usr/local/php/sbin/php-fpm

View process: PS aux | grep PHP modifies the Web site root directory:
Vim/usr/local/nginx/conf/nginx.conf
Place the location/{root HTML;        Index index.php index.html index.htm; } instead
Location/ {      root   /home/www;      Index  index.php index.html index.htm;}

The directory address here also needs to be modified to:
Location ~ \.php$ {      root           /home/www;      Fastcgi_pass   127.0. 0.1:9000;      Fastcgi_index  index.php;      Fastcgi_param  script_filename  /scripts$fastcgi_script_name;      Include        Fastcgi_params;}

-------------------------------------------------------------------------------------------------

Install MySQL:
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpmRPM-IVH mysql-community-release-el7-5. noarch.rpmyuminstall mysql-community-server

After successful installation, restart the MySQL service:

Service mysqld Restart

The initial installation of MySQL is a root account without a password:

Mysql-u root-p Encounter password prompt, enter to enter

How to set the root password:

Mysqladmin-u root password "root" enters Mysql:mysql-u root-p enter Password:root-------------------------------------- --------------------------------------------------link:http://www.cnblogs.com/farwish/p/4161417.html@ Black Eyed poet < Www.chenwei.ws>

CentOS7 Build Nginx + PHP + MySQL

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.