apache2 reload导致404直到重新打开浏览器

Trying to make our redeploy scenario deploy with 0 seconds downtime on apache/php/codeigniter we do the following:

  • We send a zip files to the server and unzips them in a new appfolder /app_timestamp

  • We overwrite the existing apache conf for the (only virtual host info) pointing to /app_timestamp

  • We trigger an /etc/init.d/apache2 reload to reload the configuration.

Everything works perfect except that a user already on the site suffers a 404 error after deployment. If the user closes his browser and opens up the same url again it starts working again.

Instead of having the apache conf point to /app_timestamp, have it point to /app_latest and create /app_latest to be a symlink to /app_timestamp. When deploying a new package, unzip as before into /app_timestamp. Then simply move the symlink to point to the new /app_timestamp. No apache reload required.