热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

nginx使用yum安装mysql_CentOS6.5yum安装配置lnmp服务器(Nginx+PHP+MySQL)

2、安装PHP组件,使PHP支持MySQL、PHP支持FastCGI模式yuminstallphp-mysqlphp-gdlibjpeg*php-imapphp-ld

2、安装PHP组件,使PHP支持 MySQL、PHP支持FastCGI模式

yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm          #根据提示输入Y回车

/etc/init.d/mysqld restart  #重启MySql

/etc/init.d/nginx  restart  #重启nginx

/etc/rc.d/init.d/php-fpm start  #启动php-fpm

chkconfig php-fpm on  #设置开机启动

#############################################################################

配置篇

一、配置nginx支持php

cp /etc/nginx/nginx.conf  /etc/nginx/nginx.confbak    #备份原有配置文件

vi /etc/nginx/nginx.conf  #编辑

user  nginx  nginx;  #修改nginx运行账号为:nginx组的nginx用户

:wq!    #保存退出

cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.confbak   #备份原有配置文件

vi /etc/nginx/conf.d/default.conf   #编辑

index index.php index.html index.htm;   #增加index.php

# pass the PHPscripts 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  $document_root$fastcgi_script_name;

include       fastcgi_params;

}

#取消FastCGI server部分location的注释,并要注意fastcgi_param行的参数,改为$document_root$fastcgi_script_name,或者使用绝对路径

二、配置php

vi /etc/php.ini   #编辑

date.timezone= PRC     #在946行 把前面的分号去掉,改为date.timezone = PRC

disable_functions=passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec

,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink

,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen

,disk_free_space,checkdnsrr,getservbyname,getservbyport,disk_total_space

,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid

,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp

,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid

,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid

,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname

#在386行 列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。

expose_php = Off        #在432行 禁止显示php版本的信息



推荐阅读
author-avatar
用途回家
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有