ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
**一、查看系统的版本号** cat /etc/redhat-release **二、关闭系统防火墙** chkconfig iptables off **三、配置CentOS 6.0 第三方yum源(CentOS默认的标准源里没有nginx软件包)** 1. wget http://www.atomicorp.com/installers/atomic 2、sh ./atomic **四、安装开发包和库文件** yum install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel **五、卸载已安装的apache、mysql、php** 1.yum remove httpd 2.yum remove mysql 3.yum remove php **六、安装Nginx** 1.yum install nginx 2.service nginx start 3.chkconfig --levels 235 nginx on(设置开机自启动) **七、安装mysql** 1.yum install mysql mysql-server mysql-devel 2. service mysqld start 3.chkconfig --levels 235 mysqld on 4.登陆MySQL删除空用户,修改root密码 select user,host,password from mysql.user;】 drop user ''@localhost; update mysql.user set password = PASSWORD('*********') where user='root'; flush privileges; **八、安装Php** 1、yum install php lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap 2、yum install php-tidy php-common php-devel php-fpm php-mysql(安装php和所需组件使PHP支持MySQL、FastCGI模式) 3、service php-fpm start 4、 chkconfig --levels 235 php-fpm on **九、配置Nginx支持Php** 1、mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak(备份) 2. cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf(默认的配置文件作为配置文件) 3. vi /etc/nginx/nginx.conf(编辑配置文件) index index.php index.html index.htm;(加入index.php,将以下代码注释去掉,并修改成nginx默认路径) location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } service nginx restart service php-fpm restart **十、 配置php** 编辑文件php.ini,在文件末尾添加cgi.fix_pathinfo = 1 重启nginx php-fpm 建立info.php文件 vi /usr/share/nginx/html/info.php(目录和文件名可以自定) <?php phpinfo(); ?> 测试nginx是否解析php(浏览器输入:IP/info.php)