Centos6.9 under Yum install nginx1.10 + mysql5.6 + php5.6

Source: Internet
Author: User
Tags fpm install php mysql code iptables

First, the preparatory work
1, check whether SELinux is closed, not for disable need to change to disable.
Selinux=disabled

If not for disabled, then change to selinux=disabled.
2, check the environment has not installed too low version of
Rpm-qa|grep MySQL
Mysql-libs-5.1.73-8.el6_8.x86_64

Rpm-qa|grep Nginx

Rpm-qa|grep PHP

From the above can be learned that the Linux yum over a mysql-libs-5.1.73-8.el6_8.x86_64, wait for the installation of MySQL5.6 version, the first to do uninstall.

3, can see there is no MySQL nginx PHP and other related commands, there may be the source code installed, if there is also need to uninstall.

Whereis Nginx

Whereis PHP
Whereis MySQL

4, open the firewall on the opening of 80 ports, 3306 port to see your external demand again open (security considerations need to open up, but also authorized to the corresponding trust IP access only)

The newly installed system defaults to shutting down the iptables

Vim/etc/sysconfig/iptables
Add the following content
*filter
: INPUT ACCEPT [0:0]
: FORWARD ACCEPT [0:0]
: OUTPUT ACCEPT [1:140]
: Rh-firewall-1-input-[0:0]
-A input-j Rh-firewall-1-input
-A forward-j Rh-firewall-1-input
-A rh-firewall-1-input-i lo-j ACCEPT
-A rh-firewall-1-input-p icmp-m ICMP--icmp-type any-j ACCEPT
-A rh-firewall-1-input-m state--state related,established-j ACCEPT
-A rh-firewall-1-input-p tcp-m state--state new-m TCP--dport 22-j ACCEPT
-A rh-firewall-1-input-p tcp-m state--state new-m TCP--dport 80-j ACCEPT
-A rh-firewall-1-input-j REJECT--reject-with icmp-host-prohibited
COMMIT

Restart iptables after saving

Service Iptables Restart

Second, install Nginx
CentOS 6.9 Default is the nginx1.10 version, want to install nginx higher version can download Nginx official website yum source for installation, here omit to see the other version of the installation of reference bar.
1. Remove the package that comes with the system
Yum remove httpd php
2. Installing Nginx
Yum install-y Nginx

3, set the Nginx boot
Chkconfig Nginx on
4. Start Nginx
Service Nginx Start

Third, installation MySQL5.6

1. Check if MySQL has a related package

Whereis MySQL
MySQL:/usr/lib64/mysql/usr/share/mysql

Rpm-qa|grep MySQL
Mysql-libs-5.1.73-8.el6_8.x86_64

Uninstalling mysql-libs-5.1.73-8.el6_8.x86_64
Yum Remove Mysql-libs

2. Empty Dbcache
Yum Clean Dbcache

3. Download MySQL RPM installation package

wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm

4. Install the MySQL installation source
Install the downloaded RPM file using RPM-IVH mysql-community-release-el6-5.noarch.rpm ~
RPM-IVH mysql-community-release-el6-5.noarch.rpm

5, Installation Mysql-community-server
Install MySQL server using the Yum install Mysql-community-server.
Yum Install Mysql-community-server

6. Start the MySQL service
Service mysqld Start

7. Modify MySQL Password
Change Password ~

Use Update user set Password=password ("Your_password") where user= ' root '; change root account password ~

mysql> use MySQL;
Reading table information for completion of table and column names
Can turn off this feature to get a quicker startup with-a

Database changed
mysql> Update user Set Password=password ("Your_password") where user= ' root ';
Query OK, 4 rows Affected (0.00 sec)
Rows Matched:4 Changed:4 warnings:0

mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)

Mysql> quit

Password verification
Log back in to the MySQL service

At this point, MySQL installation is complete ~

Iv. installation of PHP5.6

Check the currently installed PHP package
Yum List Installed | grep php

If you have a PHP package installed, remove them first, such as:
Yum Remove php.x86_64 php-cli.x86_64 php-common.x86_64

Configure the installation package Source: Install the source according to the specific Linux system version.

Centos 5.X

RPM-UVH http://mirror.webtatic.com/yum/el5/latest.rpm

CentOs 6.x

RPM-UVH http://mirror.webtatic.com/yum/el6/latest.rpm

CentOs 7.X

RPM-UVH https://mirror.webtatic.com/yum/el7/epel-release.rpm
RPM-UVH https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

If you want to remove the packages installed above, reinstall
Rpm-qa | grep nginx
RPM-E [the package found above]

Performing the installation
Yum-y Install php56w.x86_64
Yum-y--enablerepo=webtatic Install Php56w-devel
Yum-y Install php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 Php56w-pdo.x86_64 php56w-opcache.x86_64

Install PHP FPM
Yum-y Install PHP56W-FPM

#设置php-fpm boot up
Chkconfig PHP-FPM on

#启动php-FPM
/ETC/INIT.D/PHP-FPM start

Five, configuration

    1. Configure Nginx
      Vi/etc/nginx/conf.d/default.conf
      Add the following content:

server{
Listen 80;
Servername ; Fill in your domain name here
Index index.php index.html index.htm;
root/var/www/html;

location ~ .*\.(php|php5)?${        fastcgi_pass  127.0.0.1:9000;        fastcgi_index index.php;        include fastcgi.conf;  

 
Method Two:
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;

}location / {    try_files $uri $uri/ /index.php?$query_string;}

}
Description:/var/www/html is the Web root directory, "location/" ... Rewrite for URLs, hide index.php

    1. Configure PHP-FPM
      Vi/etc/php-fpm.d/www.conf
      Set user and user groups to Nginx, such as:

#修改用户为nginx
user = Nginx
#修改组为nginx
Group = Nginx
Start testing
Cd/var/www
VI index.php
Add the following code

<?php
Echo Phpinfo ();
?>
: wq! Save exit

#设置权限
Chown Nginx.nginx/var/www-r
#重启nginx
Service Nginx Restart//(if fastcgi.conf not found:, please refer to the above configuration Method II)
#重启php-FPM
Service PHP-FPM Restart
In the client browser enter the server IP address (for example: 127.0.0.1), you can see the relevant configuration information!

If it is a virtual machine, then use Ifconfig to get the virtual machine IP, in the browser input: Virtual machine ip/index.php, you can see the relevant configuration information!
Description the configuration was successful!

3. Change MySQL code to UTF8
VIM/ETC/MY.CNF add a bit of content

Character_set_server = UTF8

Centos6.9 under Yum install nginx1.10 + mysql5.6 + php5.6

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.