简体   繁体   English

将Laravel部署到AWS EC2

[英]Deploy Laravel to AWS EC2

I already deployed successfully a Laravel and vuejs project to AWS. 我已经成功地将Laravel和vuejs项目部署到了​​AWS。

I put the project and app.js everything, into ~/laravel then i created a symlink in /var/www/html/laravel/ that point to ~/laravel/public 我将项目和app.js的所有内容都放入〜/ laravel,然后在/ var / www / html / laravel /中创建了一个指向〜/ laravel / public的符号链接

It is working fine. 一切正常。 I got one problem, whenever i pull a new code including app.js from the branch in github. 每当我从github的分支中提取包括app.js的新代码时,我都会遇到一个问题。 The code is updated, but when i go to the website, its not updating yet. 代码已更新,但是当我转到网站时,它尚未更新。 Several hours later, its back to normal with my new updated code. 几个小时后,我的新更新代码恢复了正常。

Its driving me nut cause i can not test it right away any suggestion 它使我发疯,因为我无法立即测试任何建议

Thank you 谢谢

I encountered this behavior when the server was enabled OPcache. 在服务器启用OPcache时遇到此问题。

try clear OPcache 尝试清除OPcache

https://jenssegers.com/77/clearing-php-s-opcache-with-cachetool https://jenssegers.com/77/clearing-php-s-opcache-with-cachetool

Adding a version number on your app.js every time you compile your assets should fix this. 每次编译资产时,在app.js上添加一个版本号即可解决此问题。 If you are using Laravel mix, simply add on webpack.mix.js file 如果您正在使用Laravel mix,只需添加webpack.mix.js文件

if (mix.inProduction()) {
    mix.version(); // this will add a version number to your app.js 
                   //  every time you do `npm run production`
                   // ex: app.js?id=b35f8fd52c344cb84a52
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM