centos6.5 x86_64下yum安裝nginx和php

平臺:centos 6.5 64位最小化+development toolsphp


rpm -Uvh http://mirrors.yun-idc.com/epel/6/x86_64/epel-release-6-8.noarch.rpm html

EPEL,即Extra Packages for Enterprise Linux,企業版linux附加包。這個軟件倉庫裏有不少很是經常使用的軟件,並且是專門針對RHEL設計的,對RHEL標準yum源是一個很好的補充,徹底無償使用,由Fedora項目維護,因此若是你使用的是RHEL,或者CentOS,Scientific等RHEL系的linux,能夠很是放心的使用EPEL的yum源。mysql

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpmlinux

remi依賴於EPEL源,有最新版本的PHP、MYSQL等軟件。nginx

yum -y install nginxsql

yum --enablerepo=remi -y install php php-fpmcentos

yum install postfix(可選,有的會提示須要postfix)tcp

yum --enablerepo=remi install php-gd php-mysql php-mbstring php-xml php-mcryptphp-fpm

chkconfig --level 35 php-fpm onpost

chkconfig --level 35 nginx on

vi /etc/nginx/conf.d/default.conf


#location / {

root   /usr/share/nginx/html;

index  index.php index.html index.htm;

#}

修改如下代碼

# location ~ \.php$ {

#    root       html;

#    fastcgi_pass   127.0.0.1:9000;

#    fastcgi_index  index.php;

#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

#    include        fastcgi_params;

#}

去掉除root行外的#,/scripts 改爲$document_root

vi /usr/share/nginx/html/index.php

<?php

  phpinfo();

?>

service php-fpm start

service nginx start

測試http://serverIP

iptables -I INPUT -p tcp --dport 80 -j ACCEPT

service iptables restart

或者service iptables stop

相關文章
相關標籤/搜索