CentOS默認(rèn)源里沒有nginx軟件 :wget http://www.atomicorp.com/installers/atomic
sh ./atomic #安裝YUM源
yum check-update #更新yum軟件包
一、安裝nginx
yum install nginxservice nginx startchkconfig nginx on
二、安裝mysql
yum install mysql mysql-server mysql-develservice mysqld startchkconfig mysqld on
三、安裝php
#安裝PHP及組件,使PHP支持 MySQL、PHP支持FastCGI模式
yum install php php-mysql php-gd libjpeg* php-pear php-xml php-mbstringphp-mcrypt php-mhash libmcrypt libmcrypt-devel php-imap php-ldap php-odbc php-bcmath php-xmlrpc php-fpmservice mysqld restartservice nginx restartservice php-fpm start
四、配置nginx支持php
vi /etc/nginx/nginx.conf #修改運(yùn)行用戶user nginx;vi /etc/nginx/conf.d/default.conf #開啟php支持index index.php index.html index.htm;location ~ \.php$ { root html; #取消FastCGI server部分location的注釋 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name; #$document_root設(shè)置為網(wǎng)站根目錄 include fastcgi_params; }
1、配置php
date.timezone = Asia/Shanghai #設(shè)置時(shí)區(qū)expose_php = OFF #禁止顯示版本信息
2、配置php-fpm
vi /etc/php-fpm.d/www.confuser = nginxgroup = nginx
3、測(cè)試
chown -R nginx.nginx /usr/share/nginx/html/ #設(shè)置目錄所有者chmod 774 -R /usr/share/nginx/html/ #設(shè)置目錄權(quán)限service mysqld restartservice nginx restartservice php-fpm restartcd /usr/share/nginx/html/vi index.php<?Php phpinfo();?>
http://127.0.0.1 #可以看到相關(guān)的配置信息!
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。