Nginx to do front-end forwarding, PHP to PHP-FPM processing (NGINX+PHP-FPM)

Source: Internet
Author: User
Tags phpinfo

    1. Download wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm


2. Yum-y Install Nginx


3. Service Nginx Restart


See WELCOME to NGINX instructions for installation success!


4.yum-y Install PHP-FPM


5. Let Nginx support PHP-FPM

Find /etc/nginx/conf.d/default.conf, Open Edit It

>vi/etc/nginx/conf.d/default.conf

Remove the comments from the following section to supportPHPScript:

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 /etc/nginx/fastcgi_params;

}


which

fastcgi_param SCRIPT_ Filename /usr/share/nginx/html $fastcgi _script_name;    

/usr/share/nginx/html


include      /etc/nginx / fastcgi_params;

/etc/nginx/fastcgi_params; to ensure that the file address is found


6.

Restart Nginx Service

>/etc/init.d/nginx stop

>/etc/init.d/nginx start

Start PHP-FPM

>/usr/local/sbin/php-fpm

Build PHP Test files

VI phpinfo.php

Its contents:

<?php

Phpinfo ();

?>

Browse http:// ip address) /phpinfo.php

If a PHP Featured logo page, it means the installation was successful.



Nginx to do front-end forwarding, PHP to PHP-FPM processing (NGINX+PHP-FPM)

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.