Configure Nginx to support PHP under CentOS

Source: Internet
Author: User

Add nginx default Home page index.php

Vim/etc/nginx/conf.d/default.conf

Location/{

root/usr/share/nginx/html;

Index index.html index.htm index.php;

}

Configuring Nginx Support PHP

Vim/etc/nginx/conf.d/default.conf

# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

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;

}

Configure PHP-FPM

Vim/etc/php-fpm.d/www.conf

; Unix User/group of processes

; Note:the user is mandatory. If The group is not set, the default user ' s group

; would be used.

; Rpm:apache choosed to being able to access some dir as httpd

user = Nginx

; Rpm:keep a group allowed to write in log dir.

Group = Nginx

Chkconfig php-fpm on #设置php-fpm self-priming

Chkconfig mysqld on #设置mysqld自启动

Service Nginx Restart #重新启动nginx

Service PHP-FPM start #启动php-fpm

Service mysqld Start #启动mysqld

Configure Nginx to support PHP under CentOS

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.