Configuring Nginx Support PHP

Source: Internet
Author: User

Configuring Nginx Support PHP

Vi/usr/local/nginx/conf/nginx.conf #编辑配置文件

User www www; #首行user去掉注释, modify the Nginx run group to www www; must be the same as the User,group configuration in/usr/local/php5/etc/php-fpm.conf, or PHP will run in error

Index index.php index.html index.htm; #添加index. php

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

#

Location/{

root HTML;

Index index.html index.htm;

}

Location ~ \.php$ {


root HTML;


Fastcgi_pass 127.0.0.1:9000;


Fastcgi_index index.php;


Fastcgi_param script_filename/usr/local/nginx/html/$fastcgi _script_name;


Include Fastcgi_params;


}


Note: Uncomment the FASTCGI server section of the location, and note the parameters of the Fastcgi_param row instead of/data/webroot/(this is the site root absolute path) $fastcgi _script_name


Php-cgi-b 127.0.0.1:9000-c/usr/local/php5/etc/php.ini #php配置文件的路径

/etc/init.d/nginx Restart #重启nginx


Configuring Nginx Support PHP

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.