Skip to content
Walter Dal Mut edited this page Apr 27, 2014 · 4 revisions

Before using the hard lock you have to configure your web server. Actually we provide helps for just two web servers: Nginx and Apache2

app/console corley:maintenance:dump-nginx
app/console corley:maintenance:dump-apache

In case you are working with Apache2 just issue the command dump-apache and paste the result into your .htaccess file

The command produce something like:

RewriteCond %{DOCUMENT_ROOT}/hard.lock -f
RewriteCond %{SCRIPT_FILENAME} !hard.lock
RewriteRule ^.*$ /hard.lock [R=503,L]

RewriteCond %{DOCUMENT_ROOT}/hard.lock -f
RewriteRule ^(.*)$ - [env=MAINTENANCE:1]

<IfModule mod_headers.c>
    Header set cache-control "max-age=0,must-revalidate,post-check=0,pre-check=0" env=MAINTENANCE
    Header set Expires -1 env=MAINTENANCE
</IfModule>

ErrorDocument 503 /hard.lock

Now you can use the hard lock just with the command:

app/console corley:maintenance:lock on

In order to lock down the website, or issue:

app/console corley:maintenance:lock off

in order to restore the application.

As you can see, the locker replies with 503 header and if you enable the mod_headers of your Apache2 the locker disable possibile caching problems.

ATTENTION! When you change any options you have to check that the rewrite configuration is valid! Remember to update your configuration running app/console corley:maintenance:dump-apache

Clone this wiki locally