安装并配置MySQL 5.6
从CentOS从7.x开始默认使用MariaDB。MariaDB完全兼容MySQL,包括API和命令行。但是很多时候我们还是会想要安装MySQL,所以不能直接通过yum命令安装。
下载源安装文件
wget http://repo.mysql.com//mysql57-community-release-el7-8.noarch.rpm
本地安装rpm包(配置MySQL安装源)
yum -y localinstall mysql57-community-release-el7-8.noarch.rpm
查看所有MySQL安装源(默认MySQL安装版本5.7)
yum repolist all | grep mysql
关闭MySQL 5.7安装源
sudo yum-config-manager --disable mysql57-community
开启MySQL 5.6安装源
sudo yum-config-manager --enable mysql56-community
没有yum-config-manager命令可以安装yum install yum-utils.noarch工具 或者编辑/etc/yum.repos.d/mysql-community.repo文件enable项为1表示开启,为0表示关闭
安装MySQL
yum -y install mysql-devel mysql-community-server
启动MySQL
systemctl start mysqld.service
安全配置MySQL
mysql_secure_installation
安装并配置PHP 5.6
CentOS 7.1版本中,默认安装PHP为PHP5.4版本,其中php-mysqlnd是PHP源码提供的MYSQL驱动数据库。
很多时候会对PHP环境要求校新的版本,例如PHP5.6环境,记录一种通过yum工具安装最新PHP版本的方法。首先,需要在系统上安装一个扩展yum源,即epel源。可从http://fedoraproject.org/wiki/EPEL网站下载并安装。(注意:如果文章时间久,就可能需要去重新找新的下载链接。)
下载源安装文件
wget https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
本地安装(和上面MySQL安装源命令类似)
rpm -ivh epel-release-7-8.noarch.rpm
接着,还需要一个REMI源,这个yum源提供了最新的PHP版本的下载和安装,它的官网http://rpms.famillecollet.com/。安装REMI源的过程如下。
导入gpg校验文件
rpm --import http://rpms.remirepo.net/RPM-GPG-KEY-remi
下载源安装文件
wget https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm
本地安装
rpm -Uvh remi-release-7.rpm
默认情况下,REMI是禁用的,防止多个yum源发生冲突。可以通过命令查看REMI源是否成功安装
yum repolist disabled | grep remi
通过REMI源安装需要的PHP版本,安装PHP5.6版本。
yum --enablerepo=remi-php56 install php
安装php-fpm
yum --enablerepo=remi-php56 install php-fpm
开启php-fpm
systemctl start php-fpm
安装并配置Nginx
导入gpg校验文件
rpm --import http://rpms.remirepo.net/RPM-GPG-KEY-remi
下载源安装文件(配置Nginx安装源)。可从http://nginx.org/packages/centos/网站下载安装源。(注意:如果文章时间久,就可能需要去重新找新的下载链接。)
wget http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.10.0-1.el7.ngx.x86_64.rpm
本地安装
rpm -Uvh nginx-1.10.0-1.el7.ngx.x86_64.rpm
安装Nginx
yum install nginx
开启Nginx
systemctl start nginx
Nginx主机配置(设置php-fpm)
编辑/etc/nginx/conf.d/default.conf配置文件,并重启。
server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; root /usr/share/nginx/html; index index.html index.htm index.php; #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # 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; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
更新日志
- 曾轶可.2011-一只猫的旅行【天娱传媒】【WAV+CUE】
- 黑神话悟空上品狼刺客精魄获取方法一览|上品狼刺客精魄收集攻略
- 视觉小说《神椿市建设中REGENERATE》将于2025年2月20日发售
- 黑神话悟空上品鼠弩手精魄获取方法一览|上品鼠弩手精魄收集攻略
- 中国音乐地图听见世界非物质文化遗产《非遗HQCD》wav
- 中国民乐合奏作品集《华夏之音HQ》头版限量编号[WAV+CUE]
- [电影原声带]黎允文《天将雄师》[FLAC+CUE]
- 曝NS继任机型已进入量产阶段:已花了30亿日元
- 不是Switch2?曝《马里奥惊奇》NS捆绑包即将公开
- 暖心任天堂!网友Switch维修返还时贴纸被完好保留
- 《国语老歌 经典对唱情歌 2CD》[WAV/分轨][1.1GB]
- 《刀郎 翻唱精选华语专辑 披着羊皮的狼 》[WAV+CUE][430MB]
- 《真的田震 中国乐坛红极一时的歌者 精品集》[WAV+CUE][300MB]
- 群星.1995-新滚石九大天王之情歌大全【滚石】【WAV+CUE】
- 群星.1993-滚石九大天王十二出好戏·纵夏欢唱【滚石】【WAV+CUE】