本文视频教程 https://youtu.be/TOnPkEpjbig
yum install gcc gcc-c++ make -y && yum install kernel-devel -y && yum update kernel -y
yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm && yum repolist enabled | grep "nginx*" && yum install -y nginx && systemctl enable nginx && systemctl start nginx
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 install -y php72w php72w-cli php72w-devel php72w-gd php72w-fpm php72w-mbstring php72w-pear php72w-xml php72w-xmlrpc php72w-common php72w-pdo php72w-mysqli && systemctl start php-fpm && systemctl enable php-fpm
vim /etc/php-fpm.d/www.conf
修改以下配置
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx
user = nginx
group = nginx
pecl install swoole #一路回车
vim /etc/php.ini
添加
extension=swoole.so
cd /home && curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer
rpm -ivh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm && yum -y install mysql-community-server && systemctl enable mysqld && systemctl start mysqld
grep 'temporary password' /var/log/mysqld.log
yum install -y supervisor && systemctl enable supervisord && systemctl start supervisord
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash - && yum install -y nodejs
yum install git -y
mysql -uroot -p
<输入你的mysql root密码>
create DATABASE wookteam;
如果提示You must reset your password using ALTER USER statement before executing this statement.
需要重置一下root密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Aa111111.';
如果提示Your password does not satisfy the current policy requirements
意思是密码太简单了,换一个复杂一点的
cd /var/www
git clone https://github.com/kuaifan/wookteam.git
cd wookteam
cp .env.example .env
chmod -R 777 storage
vim .env
修改以下配置
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=wookteam
DB_USERNAME=root
DB_PASSWORD=Aa111111.
composer install
php artisan key:generate
php artisan migrate --seed
npm install
npm run production
vim /etc/supervisord.d/wookteam.ini
设置文件内容
[program:wookteam]
directory=/var/www/wookteam
command=php bin/laravels start -i
numprocs=1
autostart=true
autorestart=true
startretries=3
user=root
redirect_stderr=true
stdout_logfile=/var/www/wookteam/%(program_name)s.log
vim /etc/nginx/conf.d/wookteam.conf
设置文件内容
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream swoole {
# Connect IP:Port
server 127.0.0.1:5200 weight=5 max_fails=3 fail_timeout=30s;
keepalive 16;
}
server {
listen 80;
server_name demo01.wookteam.com; #你的域名
root /var/www/wookteam/public;
autoindex off;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri @laravels;
}
location =/ws {
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header Server-Protocol $server_protocol;
proxy_set_header Server-Name $server_name;
proxy_set_header Server-Addr $server_addr;
proxy_set_header Server-Port $server_port;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# "swoole" is the upstream
proxy_pass http://swoole;
}
location @laravels {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header Server-Protocol $server_protocol;
proxy_set_header Server-Name $server_name;
proxy_set_header Server-Addr $server_addr;
proxy_set_header Server-Port $server_port;
# "swoole" is the upstream
proxy_pass http://swoole;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
systemctl restart php-fpm && systemctl restart nginx && systemctl restart supervisord
到此安装完毕,希望你使用愉快!
cd /var/www/wookteam/
git fetch --all
git reset --hard origin/master
git pull
composer update
php artisan migrate
npm install
npm run production
systemctl restart supervisord