drm30963 2018-06-22 16:01
浏览 121
已采纳

将Laravel 5.4部署到共享主机

I've got a real head-scratcher for you! I've been working on a Laravel 5.4 application for quite some time now and up until yesterday I had been able to:

  1. develop on my local machine [still works flawlessly],
  2. push my changes to my BitBucket repo [still okay here],
  3. and would subsequently pull those changes to my shared hosting server (RedHat) [still running smoothly],
  4. I then run my dependency managers (npm and composer) to get the project in place and functional
  5. there is some matter with clearing various caches:
    • php artisan view:clear
    • php artisan route:clear
    • php artisan cache:clear
    • composer dump-autoload
  6. and finally move my '/public' folder to the web root and update index.php to point back to the 'bootstrap/autoload.php' in main project structure,
  7. I am aware there is likely another or several steps I am missing, but I am unsure what they are...

All that being said, I've attempted to deploy a number of applications using Laravel lately and I always seem to run into the same issue come time to deploy an application to production. I've read 30+ tutorials on the matter and nothing seems to explain the issue why my site isn't working any more.

  • I've checked the error log file maintained by Apache, it's empty.
    • Was wondering if it's a permissions issue, doesn't seem to be the case (all folders set to 775 and files set to 664 as specified by various sources and owned by serverName:userName)
  • Browser console simply shows a 500 server error.
  • All I see if "Whoops, looks like something went wrong." twice.
    • There must be some way to show better error details (config debug setting already set to true)

Any suggestions at this point would be beneficial to send me looking in the right direction!

======= UPDATES =======

For the sake of thoroughness, and that this save others from severe headaches, I'll be posting actions taken here.

  1. Following tutorial mentioned by @user123456 (permissions applies)
  2. Generate new key for application
  3. Run php artisan config:clear
  4. Off to the races, answer to come!
  • 写回答

2条回答 默认 最新

  • drc15469 2018-06-22 17:33
    关注

    You need to ensure you have a working .env file.

    Once done, run php artisan key:generate to create a key for your application after which you should clear your application's cache as follows php artisan config:clear

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?