CENTOS6 System Installation NGINX+MYSQL+PHP-FPM Environment tutorial

Source: Internet
Author: User
Tags fpm centos iptables

A CENTOS6+NGINX+MYSQL+PHP-FPM environment was installed in the virtual machine yesterday, recording the installation process. CENTOS6 recommends installing in a netinstall manner, installing a minimized server, and configuring the site environment, the size of the virtual machine is around 700M. The following is the installation configuration NGINX+MYSQL+PHP-FPM process:

1, add source, update:

The code is as follows Copy Code

# RPM-UVH http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
# Yum Update

2, installation NGINX+MYSQL+PHP-FPM:

The code is as follows Copy Code

# yum Install nginx php-fpm mysql-server php-mysql php-mbstring php-gd php-pear-y

3, set the MySQL password and MySQL, nginx, php-fpm boot:

The code is as follows Copy Code

# service Mysqld Start
# mysqladmin-u root password ' password '
# chkconfig Nginx on
# Chkconfig Mysqld on
# Chkconfig PHP-FPM on

Note: When the default installation starts PHP-FPM, the following error occurs:

Starting php-fpm:[28-nov-2011 08:11:01] ERROR: [Pool www] cannot get uid for user ' Apache '
Solution:

The code is as follows Copy Code

# vi/etc/php-fpm.d/www.conf
Find the following two lines:

user = Apache
Group = Apache

Change the Apache to Nginx.

4, open 80 ports (the default is off):

The code is as follows Copy Code

# iptables-i input-p TCP--dport 80-j ACCEPT
# Service Iptables Save
# Service Iptables Restart

5, modify Nginx configuration file, start Nginx and PHP-FPM:

The code is as follows Copy Code
# vi/etc/nginx/conf.d/default.conf

To add a php default file:

The code is as follows Copy Code

Location/{
root/usr/share/nginx/html;
Index index.php index.html index.htm;
}

Modify to the next code, add PHP support:

The code is as follows Copy Code

# location ~ php$ {
# root HTML;
# Fastcgi_pass 127.0.0.1:9000;
# Fastcgi_index index.php;
# Fastcgi_param Script_filename/usr/share/nginx/html$fastcgi_script_name;
# include Fastcgi_params;
#}

Remove all the # and blue font portions above. Start Nginx and PHP-FPM:

The code is as follows Copy Code
# service Nginx Start
# service PHP-FPM Start

6, with FileZilla upload site to/usr/share/nginx/html.

Related Article

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.