centos下配置nginx支持php_PHP_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > PHP > centos下配置nginx支持php

centos下配置nginx支持php

 2014/4/21 2:18:00  shuaigelingfei  程序员俱乐部  我要评论(0)
  • 摘要:安装phpyuminstallphpyuminstallphp-mysqlphp-gdphp-imapphp-ldapphp-odbcphp-pearphp-xmlphp-xmlrpc添加nginx默认主页index.phpvim/etc/nginx/conf.d/default.conflocation/{root/usr/share/nginx/html;indexindex.htmlindex.htmindex.php;}配置nginx支持phpvim/etc/nginx/conf
  • 标签:PHP 配置 Nginx CentOS

安装php

monospace !important; font-size: 12px !important;" class="Perl plain">yum install php ? yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

?

添加nginx 默认主页index.php?

vim /etc/nginx/conf.d/default.conf?

?

location / {

? ? ? ??root ? /usr/share/nginx/html;

? ? ? ? index ?index.html index.htm index.php;

? ? }

?

配置nginx支持php

vim /etc/nginx/conf.d/default.conf?

?

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

? ? #

? ? location ~ .php$ {

? ? ? ? root ? ? ? ? ? html;

? ? ? ? fastcgi_pass ? 127.0.0.1:9000;

? ? ? ? fastcgi_index ?index.php;

? ? ? ??fastcgi_param ?SCRIPT_FILENAME ?/usr/share/nginx/html$fastcgi_script_name;

? ? ? ? include ? ? ? ?fastcgi_params;

? ? }

?

配置php-fpm

vim /etc/php-fpm.d/www.conf

?

; Unix user/group of processes

; Note: The user is mandatory. If the group is not set, the default user's group

; ? ? ? will be used.

; RPM: apache Choosed to be able to access some dir as httpd

user = nginx

; RPM: Keep a group allowed to write in log dir.

group = nginx

?

chkconfig php-fpm on ? ?#设置php-fpm自启动

chkconfig mysqld on ? ? #设置mysqld自启动

service nginx restart ? #重新启动nginx

service php-fpm start ? #启动php-fpm

service mysqld start ? ?#启动mysqld

上一篇: 点名时间的 CEO 张佑怎么看智能硬件? 下一篇: 没有下一篇了!
发表评论
用户名: 匿名