linux 服务器 php vue项目部署流程总结

服务器配置

  • 购买阿里云服务器 (选择ubuntu 16系统 / 内存2G以上)
  • 安全策略, 入规则: 添加端口 20,21,22, 80, 443, 3306, 8080,
  • 安装宝塔 wget -O install.sh http://download.bt.cn/install/install-ubuntu.sh && sudo bash install.sh
  • 登录宝塔 安装软件 并 修改宝塔端口号.

用宝塔管理网站配置

  • 添加域名
  • 上传程序
  • 虚拟机目录指向程序public目录
  • 设置伪静态
    设置伪静态
location / {
     if (!-e $request_filename) {
          rewrite ^/(.*)$ /index.php/$1;
     }
}

允许mysql远程连接

修改/etc/my.cnf配置

在[mysqld] 添加以下项
character_set_server=utf8
skip-name-resolve
skip-external-locking
#注释掉bind-address = 127.0.0.1
#如果忘记密码,可加skip-grant-tables, 重置密码后再注释掉

登录mysql配置允许远程连接的账号权限
登录mysql, 授权navicat,所有操作,所有表,所有主机权限

sudo mysql -uroot -ppassword
grant all privileges on *.* to 'navicat'@'%' identified by '123456';
flush privileges; 
exit;

重启 mysql sudo service mysql restart
判断远程是否可连接 telnet xxx.xxx.xxx.xxx 3306
如果不能连接, 防火墙开放端口

iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
iptables -L -n
service iptables save

配置https

生成 Let's Encrypt 免费https证书

定时任务

设置定时任务

posted @ 2018-08-26 08:46  geek程序员  阅读(1274)  评论(0编辑  收藏  举报