参考文档:
http://www.zhuzhuman.com/nav-1/type-2/article/3.html
https://www.aliyun.com/jiaocheng/128853.html
https://jingyan.baidu.com/article/215817f7a10bfb1eda14238b.html
1. 安装前准备
1. 安装screen
yum install screen
2. 安装wget
yum install wget
3. 更新yum
yum update
4. 安装额外资源库
yum install epel-release
5. 下载最新ius
wget https://dl.iuscommunity.org/pub/ius/stable/CentOS/7/x86_64/ius-release-1.0-15.ius.centos7.noarch.rpm
6. 安装ius
rpm -ivh ius-release-1.0-15.ius.centos7.noarch.rpm
7. 新建www用户
adduser www
8. 设置密码(可不设置)
passwd www
9. 添加到组
usermod -aG wheel www
2. 安装nginx
1. 安装
sudo yum install nginx
2. 启动nginx
sudo systemctl start nginx
3. 设置为开机启动
sudo systemctl enable nginx.service
4. 检查开机自动是否设置成功
systemctl list-dependencies | grep nginx
注: 项目目录默认在 /var/www/ 下
配置文件在 /etc/nginx/ 下
3. 安装mysql
由于laravel5.4以后,数据库默认使用utf8mb64,
mysql版本太低时,在运行php artisan migrate 会报错,原因就是utf8和utf8mb4造成的
mysql5.7以后的版本没有 utf8 和 utf8mb64 的问题,
1. 安装5.7.x的mysql源
yum -y localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.n