安装第三方yum源
wget http://www.atomicorp.com/installers/atomic
sh ./atomic
PHP安装及插件
yum install php php-gd php-fpm php-mcrypt php-mbstring php-mysql php-pdo -y
编辑配置文件
-
修改cgi.fix_pathinfo
vim /usr/local/php/php.ini定位到 cgi.fix_pathinfo= 并将其修改为: cgi.fix_pathinfo=0
-
编辑php-fpm.conf,确保 php-fpm 模块使用nginx用户和 nginx组的身份运行。
vim /etc/php-fpm.d/www.conf
找到以下内容并修改:user = nginx group = nginx
配置Nginx
server {
listen 80;
server_name 192.168.102.2;
root /project/showdoc;
index index.php index.html index.htm;
access_log logs/showdoc_access.log;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ~ /\.ht {
deny all;
}
}