每次部署laravel项目总会遇到各种各样的问题,因此在这详细记录每个问题的解决办法!

  • 安装宝塔,https://www.bt.cn/new/download.html
  • 利用宝塔安装全家桶(nginx,php,mysql)
  • 新建数据库
  • 将你的laravel放置到"/www/wwwroot/"目录下
  • 宝塔新建一个网站,选择使用php,并绑定目录为"/www/wwwroot/你的laravel项目/public"
  • 然后网站设置中,取消这个勾选在这里插入图片描述
  • 软件商店-php设置-禁用函数中,删除"putenv",“proc_open”
  • nginx配置文件添加
    location / {
     try_files $uri $uri/ /index.php?$query_string;
     # laravel项目,开启路由访问
   }
  • 终端,执行以下命令
cd /www/wwwroot/你的项目

chmod 777 -R ./

composer install
  • 至此,正常情况下,你的网站就可以访问了!

问题
如果出现报错"production.ERROR: No application encryption key has been specified"
解决办法

在你的项目根目录中新建一个.env
运行php artisan key:generate 

如果还不行,那么执行

php artisan config:clear
php artisan config:cache

即可!

Logo

更多推荐