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