{"id":94290,"date":"2024-04-27T14:35:44","date_gmt":"2024-04-27T06:35:44","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=94290"},"modified":"2024-04-27T14:35:44","modified_gmt":"2024-04-27T06:35:44","slug":"centos6-nginx-php","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos6-nginx-php.html","title":{"rendered":"\u8be6\u89e3\uff1acentos\u4e0b\u914d\u7f6enginx\u652f\u6301php"},"content":{"rendered":"
yum install php\r\n \r\nyum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc\r\n<\/pre>\n\u6dfb\u52a0nginx \u9ed8\u8ba4\u4e3b\u9875index.php <\/strong><\/span><\/div>\n\r\nvim \/etc\/nginx\/conf.d\/default.conf \r\n\r\nlocation \/ {\r\n\r\n root \/usr\/share\/nginx\/html;\r\n\r\n index index.html index.htm index.php;\r\n\r\n }\r\n\r\n <\/pre>\n\u914d\u7f6enginx\u652f\u6301php<\/strong><\/span><\/div>\n\r\nvim \/etc\/nginx\/conf.d\/default.conf \r\n\r\n# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000\r\n\r\n #\r\n\r\n location ~ .php$ {\r\n\r\n root html;\r\n\r\n fastcgi_pass 127.0.0.1:9000;\r\n\r\n fastcgi_index index.php;\r\n\r\n fastcgi_param SCRIPT_FILENAME \/usr\/share\/nginx\/html$fastcgi_script_name;\r\n\r\n include fastcgi_params;\r\n\r\n }\r\n\r\n <\/pre>\n\u914d\u7f6ephp-fpm<\/strong><\/span><\/div>\n\r\nvim \/etc\/php-fpm.d\/www.conf\r\n\r\n; Unix user\/group of processes\r\n\r\n; Note: The user is mandatory. If the group is not set, the default user's group\r\n\r\n; will be used.\r\n\r\n; RPM: apache Choosed to be able to access some dir as httpd\r\n\r\nuser = nginx\r\n\r\n; RPM: Keep a group allowed to write in log dir.\r\n\r\ngroup = nginx\r\n<\/pre>\n\u542f\u52a8\u670d\u52a1<\/strong><\/span><\/div>\n\r\nchkconfig php-fpm on #\u8bbe\u7f6ephp-fpm\u81ea\u542f\u52a8\r\n\r\nchkconfig mysqld on #\u8bbe\u7f6emysqld\u81ea\u542f\u52a8\r\n\r\nservice nginx restart #\u91cd\u65b0\u542f\u52a8nginx\r\n\r\nservice php-fpm start #\u542f\u52a8php-fpm\r\n\r\nservice mysqld start #\u542f\u52a8mysqld\r\n<\/pre>\n\n\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.centoscn.com\/nginx\/2014\/0902\/3650.html<\/a><\/p>\n