centos7 nginx+php5.6+mysql安裝與配置

安裝與配置

php 56的安裝

php的配置寫在 php.ini,可在phpinfo()中查看php

//查找已安裝
yum list installed | grep php
// php卸載
yum -y remove php56*
yum remove httpd* php*

可用的資源: centos 安裝php56+nginxhtml

nginx + php-fpm

nginx安裝

sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
sudo yum install -y nginx
sudo systemctl start nginx.service
// 開機啓動
sudo systemctl enable nginx.service
  • nginx 配置
location ~ \.php$ {
   fastcgi_pass   127.0.0.1:9000;
   fastcgi_index  index.php;
   fastcgi_param  SCRIPT_FILENAM  $document_root$fastcgi_script_name;
   include        fastcgi_params;
}
  • php-fpm (使用php-fpm -t 能夠看到其配置所在)
sudo service php-fpm reload
sudo service php-fpm restart

php重啓

重啓php-fpm便可mysql

sudo service php-fpm reload
sudo service php-fpm restart

mysql

參考 http://www.javashuo.com/article/p-ulmwfrac-dx.htmlnginx

mysql啓動

systemctl start  mysqld.service

tip

初始密碼獲取:sql

cat /var/log/mysqld.log | grep -i 'temporary password'centos

相關文章
相關標籤/搜索