简体   繁体   中英

Deploy Laravel to AWS EC2

I already deployed successfully a Laravel and vuejs project to 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

It is working fine. I got one problem, whenever i pull a new code including app.js from the branch in github. 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.

try clear OPcache

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. If you are using Laravel mix, simply add on webpack.mix.js file

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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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