Centos6.5 system nginx + php5.6 + mysql5.5 Configuration tutorial

Source: Internet
Author: User

1. An Alibaba Cloud host with centos6.5

2. First, update the yum source. For details, refer to centos to install php5.6, but do not execute php installation. This article will separately describe the installation of php5.6.

3. Install nginx. For details, see nginx compilation and installation.

4. Install mysql5.5.

Download the corresponding version from the mysql website

Http://cdn.mysql.com//Downloads/MySQL-5.5/MySQL-server-5.5.47-1.el6.x86_64.rpm

Http://cdn.mysql.com//Downloads/MySQL-5.5/MySQL-client-5.5.47-1.el6.x86_64.rpm

Http://cdn.mysql.com//Downloads/MySQL-5.5/MySQL-devel-5.5.47-1.el6.x86_64.rpm

Run the following command on the command line:

A. Check whether mysql has been installed in linux.

Rpm-qa | grep-I mysql

# Uninstall the old version

Rpm-e -- nodeps <package name>

B. Start installation one by one

. Rpm server package downloaded by rpm-ivh

. Rpm client package downloaded by rpm-ivh

The. rpm devel package downloaded by rpm-ivh

Tip: after mysql5.5 is installed, the root user with no password 5.6.x is root.


Instructions before installation:

Nginx is an independent web server, so you cannot directly run php. You need to use the php-fpm provided by php for the transitional operation.

Php5.3 previously existed in the form of plug-ins. Later versions are included in the php installation folder. You can enable it during compilation and installation. (-- Enable-fpm is used to enable the php-fpm function by enabling the fastcgi function of php)

Mysql and nginx have been installed above, and php is installed below. php source code is not used for this installation. Yum is used for installation.


Yum install -- enablerepo = remi -- enablerepo = remi-php56 php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl- xhprof php-fpm


Note that the last php-fpm must be added. Because it depends on this operation

After the installation, execute php-m and you will see some extensions you have installed.

Next, we need to run php-fpm separately. First, we need to find the installation directory of php-fpm.

# Which php-fpm
/Usr/sbin/php-fpm // installation directory, which needs to be executed
#/Usr/sbin/php-fpm start // execute
# Netstat-apn // port 9000 occupied by 127.0.0.1: 9000 php-fpm
Tcp 0 0 127.0.0.1: 9000 0.0.0.0: * LISTEN 28521/php-fpm


Next, we need to modify the nginx configuration file.


# Find/-name "nginx. conf"

Find the conf configuration file in/etc.

# Vim/etc/nginx. conf

Find

Server {
Listen 80;
Server_name * .example.com;
Root Your web directory;
Location /{
Index. php;
    }
Location ~ . Php $ {
Root Your web directory;
Fastcgi_pass 127.0.0.1: 9001; fastcgi_index index. php;
// Note that the result is returned. Replace/script with $ document_root in the original file.
Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
Include/etc/nginx/fastcgi_params;
    }
}
Ps-aux | grep nginx
Kill the query process
// Restart
/Usr/sbing/nginx


Test the browser access ip address.

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.