本人騰訊云服務(wù)器安裝
yum 源配置 /etc/yum.repos.d/CentOS-Base.repo
如下
[extras]
gpgcheck=1
gpgkey=http://mirrors.tencentyun.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1
baseurl=http://mirrors.tencentyun.com/centos/$releasever/extras/$basearch/
name=Qcloud centos extras - $basearch
[os]
gpgcheck=1
gpgkey=http://mirrors.tencentyun.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1
baseurl=http://mirrors.tencentyun.com/centos/$releasever/os/$basearch/
name=Qcloud centos os - $basearch
[updates]
gpgcheck=1
gpgkey=http://mirrors.tencentyun.com/centos/RPM-GPG-KEY-CentOS-7
enabled=1
baseurl=http://mirrors.tencentyun.com/centos/$releasever/updates/$basearch/
name=Qcloud centos updates - $basearch
安裝NGINX
yum -y install nginx
systemctl start nginx
systemctl enable nginx
安裝PHP7.2
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml php72w-bcmath
systemctl start php-fpm.service
systemctl enable php-fpm.service
安裝Mysql5.7
下載MySql的yum包
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum命令安裝
yum -y install mysql57-community-release-el7-10.noarch.rpm
安裝MySql服務(wù)器
yum -y install mysql-community-server
啟動(dòng)mysql服務(wù)
systemctl start mysqld.service
檢查是否啟動(dòng)成功
netstat -antp
在日志文件中找到安裝時(shí)的臨時(shí)密碼
grep 'temporary password' /var/log/mysqld.log
登陸mysql后修改密碼
alter user 'root'@'localhost' identified by '123456';
如果提示 Your password does not satisfy the current policy requirements
set global validate_password_length=1;
set global validate_password_policy=0;
systemctl enable mysqld.service
更改nginx配置
修改文件/etc/nginx/nginx.conf
#根據(jù)需要修改server下 root 地址
#如果沒有index 添加, 有在index 增加 index.php
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
#php配置
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
重啟Nginx服務(wù)