mod_lock.c Apache module allows to conditionaly lock a part of a web server by just creating a file in a predefined location. This feature is useful for system maintenance on multi VirtualHosted systems.
Integrating into Apache - compiling and linking
To link the lock module with Apache, you must rebuild Apache from its sources with adding mod_lock in the configuration file:
· Copy mod_lock.c in Apache sources' directory
· Edit Configuration file according your installation
· Run the Configure script to rebuild the makefile
· Build Apache by typing make
· Install the brand new httpd program
· Edit the web server configuration files (typically httpd.conf and access.conf)
· Restart the web daemon
· Example of a Configuration file
Module mime_module mod_mime.o
Module access_module mod_access.o
Module auth_module mod_auth.o
Module negotiation_module mod_negotiation.o
Module includes_module mod_include.o
Module dir_module mod_dir.o
Module cgi_module mod_cgi.o
# Miscellaneous modules
Module lock_module mod_lock.o
SetLockFile filename default value: none context: Directory or Location effect: Enables the conditional lock for a location. The web server will check for the existence of the file each time it will access the concerned documents. If it finds it, it will return a 503 (Service unavailable) HTTP status code. remarks: if filename is a null string (""), conditional lock will be disabled for this class of documents. LockBypass host1 host2 ... default value: none context: Directory or Location effect: Allows access from an host, even if locked. remarks: hostnames can be either real hostnames (www.hp.com) or domain names (.hp.com).
wrong access rights can confuse the test of the lock file ('access denied' is equivalent to 'not found').
webuser (the user who runs the web daemon) should have read access to the lock file to avoid this behaviour.
· Apache 1.3