centos6.5 yum 安装ngixn-php-phpfpm
rpm包安装nginx php
安装nginx
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum -y install nginx
service nginx restart
chkconfig nginx on //设置开机自动启动
安装php php-fpm
rpm -Uvh http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install --enablerepo=remi,remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common
service php-fpm restart
chkconfig php-fom on //设置开机自动启动
若还是无法访问请查看防火墙状态,尝试着service iptables stop
配置文件 基础模板仅供参考:
server {
listen 80;
server_name xxxx;
location /{
root /usr/share/nginx/html/;
index index.html index.htm index.php;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/tmp/php-fcgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;
}
}
参考:https://www.aliyun.com/jiaocheng/188845.html https://www.cnblogs.com/beyang/p/6972412.html