Subject: [alpine-aports] [PATCH] main/apache2: fixups and cleanups in config files and modules, new clean openrc init script

From: Valery Kartel <[email-masked]>
Date: Tue, 1 Dec 2015 17:48:34 +0200

- init script is made from scratch. All crazy features from gentoo are removed
- in extra subpackage added config files for icons and error
- in webdav subpackage added a working config file and made necessary folders
- in proxy subpackage remove mod_proxy loading and add proxy-html as a dependency
- in proxy-html subpackage added loading of xml2enc_module
- configuration described in modules are removed from the main httpd.conf
- cleanups in APKBUILD, all references about 'apache2' changed to $pkgname variable

In the nearest future it is necessary to define and rename "apache2-" module packages
whose names start with "apache-" not "apache2-".
Or rename all apache specific packages to "apache-"
I do not think that someone would use apache 1.xx, so probably best to rename it all to "apache-"

If the patch will take place, I will continue to made cleans in the modules (mod_ssl is next)
---
 main/apache2/APKBUILD        | 184 +++++++++++++++++++++++--------------------
 main/apache2/apache2.confd   |   8 --
 main/apache2/apache2.initd   | 174 ++++++++--------------------------------
 main/apache2/error.conf      |  36 +++++++++
 main/apache2/httpd.conf      |  87 --------------------
 main/apache2/icons.conf      |   8 ++
 main/apache2/proxy-html.conf |   1 +
 main/apache2/proxy.conf      |   1 -
 main/apache2/webdav.conf     |  31 ++++++++
 9 files changed, 207 insertions(+), 323 deletions(-)
 mode change 100755 => 100644 main/apache2/apache2.initd
 create mode 100644 main/apache2/error.conf
 create mode 100644 main/apache2/icons.conf
 create mode 100644 main/apache2/webdav.conf

diff --git a/main/apache2/APKBUILD b/main/apache2/APKBUILD
index 2eb2010..ae8e331 100644
--- a/main/apache2/APKBUILD
+++ b/main/apache2/APKBUILD
@@ -3,7 +3,7 @@
 pkgname=apache2
 _pkgreal=httpd
 pkgver=2.4.17
-pkgrel=0
+pkgrel=1
 pkgdesc="A high performance Unix-based HTTP server"
 url="http://httpd.apache.org/"
 arch="all"
@@ -20,9 +20,9 @@ subpackages="$pkgname-extra $pkgname-doc $pkgname-dev $pkgname-utils $pkgname-ss
 	$pkgname-proxy
 	$pkgname-lua:_lua"
 source="http://archive.apache.org/dist/$_pkgreal/$_pkgreal-$pkgver.tar.bz2
-	apache2.confd
-	apache2.logrotate
-	apache2.initd
+	$pkgname.confd
+	$pkgname.logrotate
+	$pkgname.initd
 	httpd.conf
 	ssl.conf
 	ldap.conf
@@ -30,7 +30,9 @@ source="http://archive.apache.org/dist/$_pkgreal/$_pkgreal-$pkgver.tar.bz2
 	proxy.conf
 	lua.conf
 	alpine.layout
-	"
+	error.conf
+	icons.conf
+	webdav.conf"
 options="suid"
 
 _builddir="$srcdir"/$_pkgreal-$pkgver
@@ -49,7 +51,7 @@ build() {
 		--enable-suexec \
 		--with-suexec-caller=http \
 		--with-suexec-docroot=/var/www/localhost/htdocs \
-		--with-suexec-logfile=/var/log/apache2/suexec.log \
+		--with-suexec-logfile=/var/log/$pkgname/suexec.log \
 		--with-suexec-bin=/usr/sbin/suexec \
 		--with-suexec-uidmin=99 \
 		--with-suexec-gidmin=99 \
@@ -89,31 +91,30 @@ package() {
 	cd "$_builddir"
 	make -j1 DESTDIR="$pkgdir" install || return 1
 	# config
-	rm -r "$pkgdir"/etc/apache2/httpd.conf \
-		"$pkgdir"/etc/apache2/original \
-		"$pkgdir"/etc/apache2/extra
-	install -D -m644 "$srcdir"/httpd.conf "$pkgdir"/etc/apache2/httpd.conf \
+	rm -r "$pkgdir"/etc/$pkgname/httpd.conf \
+		"$pkgdir"/etc/$pkgname/original \
+		"$pkgdir"/etc/$pkgname/extra
+	install -D -m644 "$srcdir"/httpd.conf "$pkgdir"/etc/$pkgname/httpd.conf \
 		|| return 1
-	install -d "$pkgdir"/etc/apache2/conf.d || return 1
+	install -d "$pkgdir"/etc/$pkgname/conf.d || return 1
 
 	# init scripts and logrotate
-	install -D -m755 "$srcdir"/apache2.initd \
-		"$pkgdir"/etc/init.d/apache2 || return 1
-	install -D -m644 "$srcdir"/apache2.logrotate \
-		"$pkgdir"/etc/logrotate.d/apache2 || return 1
-	install -D -m644 "$srcdir"/apache2.confd \
-		"$pkgdir"/etc/conf.d/apache2 || return 1
+	install -D -m755 "$srcdir"/$pkgname.initd \
+		"$pkgdir"/etc/init.d/$pkgname || return 1
+	install -D -m644 "$srcdir"/$pkgname.logrotate \
+		"$pkgdir"/etc/logrotate.d/$pkgname || return 1
+	install -D -m644 "$srcdir"/$pkgname.confd \
+		"$pkgdir"/etc/conf.d/$pkgname || return 1
 
 	install -d "$pkgdir"/var/www || return 1
-	ln -fs /var/log/apache2 "$pkgdir"/var/www/logs
-	ln -fs /run/apache2 "$pkgdir"/var/www/run
-	ln -fs /usr/lib/apache2 "$pkgdir"/var/www/modules
+	ln -fs /var/log/$pkgname "$pkgdir"/var/www/logs
+	ln -fs /usr/lib/$pkgname "$pkgdir"/var/www/modules
 	rm -fr "$pkgdir"/run
 
 	# verify all MPMs are built
 	# ref #2866
 	for i in prefork event worker; do
-		if ! [ -e "$pkgdir"/usr/lib/apache2/mod_mpm_$i.so ]; then
+		if ! [ -e "$pkgdir"/usr/lib/$pkgname/mod_mpm_$i.so ]; then
 			error "$i MPM was not built"
 			return 1
 		fi
@@ -123,10 +124,14 @@ package() {
 extra() {
 	arch="noarch"
 	pkgdesc="Apache Multi Language Custom Error Documents and Public Domain Icons"
-	install -d "$subpkgdir"/usr/share/apache2
-	mv "$pkgdir"/usr/share/apache2/error \
-		"$pkgdir"/usr/share/apache2/icons \
-		"$subpkgdir"/usr/share/apache2/ || return 1
+	install -d "$subpkgdir"/usr/share/$pkgname
+	mv "$pkgdir"/usr/share/$pkgname/error \
+		"$pkgdir"/usr/share/$pkgname/icons \
+		"$subpkgdir"/usr/share/$pkgname/
+	install -D -m644 "$srcdir"/error.conf \
+		"$subpkgdir"/etc/$pkgname/conf.d/error.conf
+	install -D -m644 "$srcdir"/icons.conf \
+		"$subpkgdir"/etc/$pkgname/conf.d/icons.conf
 }
 
 # include the builddir and apxs in -dev package
@@ -142,10 +147,9 @@ dev() {
 	mv "$pkgdir"/usr/bin/apxs \
 		"$subpkgdir"/usr/bin/apxs || return 1
 
-
-	install -d "$subpkgdir"/usr/share/apache2
-	mv "$pkgdir"/usr/share/apache2/build \
-		"$subpkgdir"/usr/share/apache2/ || return 1
+	install -d "$subpkgdir"/usr/share/$pkgname
+	mv "$pkgdir"/usr/share/$pkgname/build \
+		"$subpkgdir"/usr/share/$pkgname/ || return 1
 	rm -fr "$pkgdir"/usr/share
 }
 
@@ -161,105 +165,117 @@ utils() {
 
 ssl() {
 	pkgdesc="SSL/TLS module for the Apache HTTP Server"
-	install="apache2-ssl.post-install"
-	depends="apache2 openssl"
+	install="$pkgname-ssl.post-install"
+	depends="$pkgname"
 
-	install -d "$subpkgdir"/usr/lib/apache2 || return 1
-	mv "$pkgdir"/usr/lib/apache2/mod_ssl.so \
-		"$subpkgdir"/usr/lib/apache2/mod_ssl.so || return 1
+	install -d "$subpkgdir"/usr/lib/$pkgname || return 1
+	mv "$pkgdir"/usr/lib/$pkgname/mod_ssl.so \
+		"$subpkgdir"/usr/lib/$pkgname/mod_ssl.so || return 1
 	install -D -m644 "$srcdir"/ssl.conf \
-		"$subpkgdir"/etc/apache2/conf.d/ssl.conf || return 1
-	install -d "$subpkgdir"/etc/ssl/apache2 || return 1
+		"$subpkgdir"/etc/$pkgname/conf.d/ssl.conf || return 1
+	install -d "$subpkgdir"/etc/ssl/$pkgname || return 1
 }
 
 ldap() {
 	pkgdesc="LDAP authentication/authorization module for the Apache HTTP Server"
 	url="http://httpd.apache.org/docs/2.4/mod/mod_authnz_ldap.html"
-	depends="apache2 apr-util-ldap"
+	depends="$pkgname apr-util-ldap"
 
-	install -d "$subpkgdir"/usr/lib/apache2 || return 1
-	mv "$pkgdir"/usr/lib/apache2/mod_*ldap.so \
-		"$subpkgdir"/usr/lib/apache2/ || return 1
+	install -d "$subpkgdir"/usr/lib/$pkgname || return 1
+	mv "$pkgdir"/usr/lib/$pkgname/mod_*ldap.so \
+		"$subpkgdir"/usr/lib/$pkgname/ || return 1
 	install -D -m644 "$srcdir"/ldap.conf \
-		"$subpkgdir"/etc/apache2/conf.d/ldap.conf || return 1
+		"$subpkgdir"/etc/$pkgname/conf.d/ldap.conf || return 1
 }
 
 webdav() {
 	pkgdesc="WebDAV support for the Apache HTTP Server"
-	depends="apache2"
-	replaces="apache2"
+	depends="$pkgname"
 
-	install -d "$subpkgdir"/usr/lib/apache2 || return 1
-	mv "$pkgdir"/usr/lib/apache2/mod_dav.so \
-		"$pkgdir"/usr/lib/apache2/mod_dav_*.so \
-		"$subpkgdir"/usr/lib/apache2/ || return 1
-	install -D -m644 "$_builddir"/docs/conf/extra/httpd-dav.conf \
-		"$subpkgdir"/etc/apache2/conf.d/http-dav.conf || return 1
+	install -d -o $pkgusers "$subpkgdir"/var/www/localhost/webdav
+	install -d -o $pkgusers "$subpkgdir"/var/www/localhost/uploads
+	install -d "$subpkgdir"/usr/lib/$pkgname
+	mv "$pkgdir"/usr/lib/$pkgname/mod_dav*.so \
+		"$subpkgdir"/usr/lib/$pkgname/
+	install -D -m644 "$srcdir"/webdav.conf \
+		"$subpkgdir"/etc/$pkgname/conf.d/webdav.conf
 }
 
 proxy_html() {
 	pkgdesc="HTML and XML content filters for the Apache HTTP Server"
-	depends="apache2"
-	install -d "$subpkgdir"/usr/lib/apache2 || return 1
-	mv "$pkgdir"/usr/lib/apache2/*_proxy_html.so \
-		"$pkgdir"/usr/lib/apache2/*xml2enc*.so \
-		"$subpkgdir"/usr/lib/apache2/ || return 1
+	depends="$pkgname"
+
+	install -d "$subpkgdir"/usr/lib/$pkgname || return 1
+	mv "$pkgdir"/usr/lib/$pkgname/*_proxy_html.so \
+		"$pkgdir"/usr/lib/$pkgname/*xml2enc*.so \
+		"$subpkgdir"/usr/lib/$pkgname/ || return 1
 	install -D -m644 "$srcdir"/proxy-html.conf \
-		"$subpkgdir"/etc/apache2/conf.d/proxy-html.conf || return 1
+		"$subpkgdir"/etc/$pkgname/conf.d/proxy-html.conf || return 1
 }
 
 proxy() {
 	pkgdesc="Proxy modules for the Apache HTTP Server"
-	depends="apache2"
-	install -d "$subpkgdir"/usr/lib/apache2 || return 1
-	mv "$pkgdir"/usr/lib/apache2/*_proxy*.so \
-		"$pkgdir"/usr/lib/apache2/*_lbmethod*.so \
-		"$subpkgdir"/usr/lib/apache2/ || return 1
+	depends="$pkgname $pkgname-proxy-html"
+
+	install -d "$subpkgdir"/usr/lib/$pkgname || return 1
+	mv "$pkgdir"/usr/lib/$pkgname/*_proxy*.so \
+		"$pkgdir"/usr/lib/$pkgname/*_lbmethod*.so \
+		"$subpkgdir"/usr/lib/$pkgname/ || return 1
 	install -D -m644 "$srcdir"/proxy.conf \
-		"$subpkgdir"/etc/apache2/conf.d/proxy.conf || return 1
+		"$subpkgdir"/etc/$pkgname/conf.d/proxy.conf || return 1
 }
 
 _lua() {
 	pkgdesc="Lua support for the Apache HTTP server"
-	depends="apache2"
-	install -d "$subpkgdir"/usr/lib/apache2 || return 1
-	mv "$pkgdir"/usr/lib/apache2/*_lua.so \
-		"$subpkgdir"/usr/lib/apache2/ || return 1
+	depends="$pkgname"
+
+	install -d "$subpkgdir"/usr/lib/$pkgname || return 1
+	mv "$pkgdir"/usr/lib/$pkgname/*_lua.so \
+		"$subpkgdir"/usr/lib/$pkgname/ || return 1
 	install -D -m644 "$srcdir"/lua.conf \
-		"$subpkgdir"/etc/apache2/conf.d/lua.conf || return 1
+		"$subpkgdir"/etc/$pkgname/conf.d/lua.conf || return 1
 }

 md5sums="cf4dfee11132cde836022f196611a8b7  httpd-2.4.17.tar.bz2
-257d2572921dd4506b0464441f88fab4  apache2.confd
+14ae785fd542148211b4b331ccc2d4f0  apache2.confd
 8519af87c57b50441866ad4216e4d663  apache2.logrotate
-11b2718d7a0550498aaddf41e940ad04  apache2.initd
-d99af87f64688e7e62703ca27fcfe3bd  httpd.conf
+b1bb6435c547411da9063c3352dd5928  apache2.initd
+913fbe9d12aa52930204d24ba61762e6  httpd.conf
 fd2d16bda774c7a28668b0652ebc7ab8  ssl.conf
 b70fe826486043e3953cfe21f9e6fa16  ldap.conf
-fe26a0a70f572eb256a3c6c183a62223  proxy-html.conf
-96eddccfca1ec0349f844e2460cf655b  proxy.conf
+ab7cf8f67e0f2367bdb50c998ed97027  proxy-html.conf
+295e0ecf4f084189d2aa7bb199e6a62b  proxy.conf
 449a4aea60473ac4a16f025fca4463e3  lua.conf
-699aec01d2f7c5a67c10d0fe280780b7  alpine.layout"
+699aec01d2f7c5a67c10d0fe280780b7  alpine.layout
+40f52bfdc2eeba440b06bd7c615874e9  error.conf
+d00aff4901fad3a58f1e65ce99c9f6f5  icons.conf
+7807ec1ae0f22fa974bb6b022fed1607  webdav.conf"
 sha256sums="331e035dec81d3db95b048f036f4d7b1a97ec8daa5b377bde42d4ccf1f2eb798  httpd-2.4.17.tar.bz2
-6ca904ad65c1a4122d8ea4a3303ea8184429a4a4d7fb81defc30f3e184258c0a  apache2.confd
+7c7c15650e09e45eb83d142a3a8bb18ba2c1ed51035e3ee29b748e4d5af20553  apache2.confd
 8e2a8870d51796cf04cc7d8985c43e36afe9ae79e2d6765050a0e72c0de8dce7  apache2.logrotate
-8761faa68c2db7114b3f463f3b8ef1aec8f8373da9908d943cc765765914ab36  apache2.initd
-758f7dca0070544697247e42338fc72511eb8927055fc66e8b1b39592b236e67  httpd.conf
+6eb89bec3315bef1b5aa9614f198c0f63c1dc157b5bd591b72ae3b89ef0c7054  apache2.initd
+da4526838f86114cdeff92d4fdbac6d8b216778934094ec660d6a2ed53498522  httpd.conf
 75519a29d04e20383097477801dd6cc9bb6ca325aa514bf69081429d73b21012  ssl.conf
 25771023d7c921a13c792607d47bd716c92698b20af21c018f0922eaf79a9604  ldap.conf
-2511d6ea64c0f253b219670c445ed4f403f94caba5fb05e0b9600f0d107e1dda  proxy-html.conf
-00c42b7806eaa73e732be9d9e92c3e841b20c6d91a9920be47f19db8aee3513e  proxy.conf
+0f0773e49809cb7a27212c03d99773ee515f0670a1c903cb07c21b3a959c731b  proxy-html.conf
+bb24fbf960944558f06aa866bcceaba4b31cd868f938ed70ecc3806760ea5262  proxy.conf
 edf701795137566c7cf4b9c0c95ecd5f8c58269f5600217a0a4d289d2bf15384  lua.conf
-c40668ae8384d0555488660b68eda16ad8ccb11fde16a8197d33bed739fed1e8  alpine.layout"
+c40668ae8384d0555488660b68eda16ad8ccb11fde16a8197d33bed739fed1e8  alpine.layout
+18bbd553d1d9f280ab65c99f6f5d6c45f80cfbb6336aa53a259be9fc73427b37  error.conf
+f9d3606d9a4df34b38e91fc2455e58b5e2b81a4b967d580c3bdd48b0b7ea5d5b  icons.conf
+ad7d29bfced866beda7e9b76ec2e1f948faf2185f1f08fafd055c586733d0ae7  webdav.conf"
 sha512sums="d818dbd4b138db592a98fecdf5ae13dfadc19f9553e98bdafbdadd4693ae19bb44c96c8c279e9546978bbce55b9286ce3c4ae69cf701a9812be134a3a517b1f6  httpd-2.4.17.tar.bz2
-8e62b101f90c67babe864bcb74f711656180b011df3fd4b541dc766b980b72aa409e86debf3559a55be359471c1cad81b8779ef3a55add8d368229fc7e9544fc  apache2.confd
+7fa347dc23829156b75160dacb3b045856d62c3c12b20b29006e3d56be2f6b804add1090f69024d8845b4e180e53f6dad736a90ce2a7b8e9553687ce88b99e52  apache2.confd
 18e8859c7d99c4483792a5fd20127873aad8fa396cafbdb6f2c4253451ffe7a1093a3859ce719375e0769739c93704c88897bd087c63e1ef585e26dcc1f5dd9b  apache2.logrotate
-81a2d2a297d8049ba1b021b879ec863767149e056d9bdb2ac8acf63572b254935ec96c2e1580eba86639ea56433eec5c41341e4f1501f9072745dccdb3602701  apache2.initd
-ddbf077826ea16c9ecafea7b606adad04d5f4ce126f0d64fe677d9b6f4d81fddcd83a3f9d73c5c734ea0012e69c44c9d81bd0d4864aa4111045ab20f68cfbd13  httpd.conf
+7cecd1491049369474fe65f31940e16d708211aebb84b82c6719b5c6c0d6073a6fdfdf0d3f6eea50c8d9a06615960556ad8fb0966a29c0c8b5634abdb10df2c8  apache2.initd
+3100f1973782cfe4e9563e024332292bb921301936ba5c327bb34f65a4399e3385d932cdff6e2bf745b0b3adf82e71e61aecba919013c63fd60b877028f06486  httpd.conf
 c164caf143993d0c2a93766988a2480232b0f42731c291e56b9ddc03c9fe6e02994b9e7adfdcde1b49e2bcb43f4c90ba1e2e2af74ac3b7e1dbebd8baadc63a18  ssl.conf
 fbdc28ea4b94af91640794945ac4e1f45e4200e54d5bdf64c0c03fc8bdb589e444cc4f7dd0b70b696c0e5e033c8489b8bd8f8fd090906c4379651c7d032c2449  ldap.conf
-263149f4a0b515e3b6d162ff282ffa90f8a448c10eb7185aec0caf75af7691b5486fa74ebe4fd46ae0ccdcf226a227705b4be4c23ed12b6d0c0aedd94a348810  proxy-html.conf
-aabbe171219f15efe47f8e972fc1a43f98b48977aae91b597b65bb447027992bf81757bde68b26a67e5e3b9f2e748d94b3c85d5c07433627b6048d60a51d400b  proxy.conf
+906c8b46aee248173ad5ce79540e5a9755ee0ee6f898db0f5d6b2e065c034ac5342e3a3370d09d1b9d0c2fea6f65780321644998910a9ca7828ef21ac5d6c0e4  proxy-html.conf
+5316e76003e8b09751b452e8235f9f34558ac5b09072114e35a49b3186d7d6ea395e22fd99f332bffeda711da304b8fb97c82355486ede091ae9ce3a92f402ef  proxy.conf
 f2950005ac0d8c7a5e34958f1274c9ed0f5f634a5bc766e12834917937df9db901c5fc2460da70e1a62f17440d4719163cd4213496dbf579c80a789b8e18f65c  lua.conf
-177c58d049fc4476fd9b9b36b67725145777c84cf81948105c9314cb09312dff6c1931fe21aaa243597abaefded6c6dfd80d83839e45a23950b50de615d73b06  alpine.layout"
+177c58d049fc4476fd9b9b36b67725145777c84cf81948105c9314cb09312dff6c1931fe21aaa243597abaefded6c6dfd80d83839e45a23950b50de615d73b06  alpine.layout
+bf217403e784a10c2967a7118a3b577e88fbff8df07688ac1d443a4e7405d293639cb1d6371e1a9d860ec7c7bab8909636fe0bf841dcb231a3568945cd718ca6  error.conf
+19e7d01179eb932639c61f5fc886d0b714c9f902c4a001e8dafe4fb92dfeceeaeec34ebe853f863ca5822b462169d24ca15a1fe44e6eac1e9910c9044d7e4cfb  icons.conf
+4f5ac901f75240045d7f9ed2981da96b8714ac3141cba8a915394994b55be32f3b9ca7cb2d52bc639ee9f347021b3100484c8a6d2cd50c2bf07d0dfac57d1eda  webdav.conf"
diff --git a/main/apache2/apache2.confd b/main/apache2/apache2.confd
index aeb3222..58334da 100644
--- a/main/apache2/apache2.confd
+++ b/main/apache2/apache2.confd
@@ -39,14 +39,6 @@ HTTPD_OPTS=
 # They are normally dumped to your terminal.
 #STARTUPERRORLOG="/var/log/apache2/startuperror.log"
 
-# A command that outputs a formatted text version of the HTML at the URL
-# of the command line. Designed for lynx, however other programs may work.
-#LYNX="lynx -dump"
-
-# The URL to your server's mod_status status page.
-# Required for status and fullstatus
-#STATUSURL="http://localhost/server-status"
-
 # Method to use when reloading the server
 # Valid options are 'restart' and 'graceful'
 # See http://httpd.apache.org/docs/2.2/stopping.html for information on
diff --git a/main/apache2/apache2.initd b/main/apache2/apache2.initd
old mode 100755
new mode 100644
index 2975e7a..eacde15
--- a/main/apache2/apache2.initd
+++ b/main/apache2/apache2.initd
@@ -1,154 +1,42 @@
 #!/sbin/openrc-run
 
-extra_commands="configdump configtest modules virtualhosts"
-extra_started_commands="fullstatus graceful gracefulstop reload"
+pidfile=${PIDFILE:-/run/apache2/httpd.pid}
+configfile=${CONFIGFILE:-/etc/apache2/httpd.conf}
+serverroot=${SERVERROOT:-/var/www}
+command=${HTTPD:-/usr/sbin/httpd}
+command_args="-d $serverroot -f $configfile $HTTPD_OPTS"
+extra_started_commands="reload"
+required_files=$configfile
+required_dirs="$serverroot/modules $serverroot/logs"
+retry=${TIMEOUT:-10}
 
 depend() {
 	need net
-	use mysql dns logger netmount postgresql
-	after sshd firewall
-}
-
-configtest() {
-	ebegin "Checking ${SVCNAME} configuration"
-	checkconfig
-	eend $?
-}
-
-checkconfd() {
-	PIDFILE="${PIDFILE:-/run/apache2/httpd.pid}"
-	TIMEOUT=${TIMEOUT:-10}
-
-	SERVERROOT="${SERVERROOT:-/var/www}"
-	if [ ! -d ${SERVERROOT} ]; then
-		eerror "SERVERROOT does not exist: ${SERVERROOT}"
-		return 1
-	fi
-
-	CONFIGFILE="${CONFIGFILE:-/etc/apache2/httpd.conf}"
-	[ "${CONFIGFILE#/}" = "${CONFIGFILE}" ] && CONFIGFILE="${SERVERROOT}/${CONFIGFILE}"
-	if [ ! -r "${CONFIGFILE}" ]; then
-		eerror "Unable to read configuration file: ${CONFIGFILE}"
-		return 1
-	fi
-
-	HTTPD_OPTS="${HTTPD_OPTS} -d ${SERVERROOT}"
-	HTTPD_OPTS="${HTTPD_OPTS} -f ${CONFIGFILE}"
-	[ -n "${STARTUPERRORLOG}" ] && HTTPD_OPTS="${HTTPD_OPTS} -E ${STARTUPERRORLOG}"
-	return 0
-
-}
-
-checkconfig() {
-	checkconfd || return 1
-
-	${HTTPD} ${HTTPD_OPTS} -t 1>/dev/null 2>&1
-	ret=$?
-	if [ $ret -ne 0 ]; then
-		eerror "${SVCNAME} has detected an error in your setup:"
-		${HTTPD} ${HTTPD_OPTS} -t
-	fi
-
-	return $ret
-}
-
-start() {
-	checkconfig || return 1
-	checkpath --directory $(dirname $PIDFILE)
-
-	[ -f /var/log/apache2/ssl_scache ] && rm /var/log/apache2/ssl_scache
-
-	ebegin "Starting ${SVCNAME}"
-	start-stop-daemon --start \
-		--pidfile ${PIDFILE} \
-		--exec ${HTTPD} \
-		-- ${HTTPD_OPTS} -k start
-	eend $?
-}
-
-stop() {
-	checkconfd || return 1
-
-	ebegin "Stopping ${SVCNAME}"
-	start-stop-daemon --stop --pidfile ${PIDFILE} --exec ${HTTPD} \
-		--retry ${TIMEOUT}
-	eend $?
-}
-
-reload() {
-	RELOAD_TYPE="${RELOAD_TYPE:-graceful}"
-
-	checkconfig || return 1
-	service_started "${SVCNAME}" || return
-
-	if [ "${RELOAD_TYPE}" = "restart" ]; then
-		ebegin "Restarting ${SVCNAME}"
-		${HTTPD} ${HTTPD_OPTS} -k restart
-		eend $?
-	elif [ "${RELOAD_TYPE}" = "graceful" ]; then
-		ebegin "Gracefully restarting ${SVCNAME}"
-		${HTTPD} ${HTTPD_OPTS} -k graceful
-		eend $?
+	use dns logger netmount
+}
+
+start_pre() {
+	ebegin
+	[ -n "$STARTUPERRORLOG" ] && command_args="-E $STARTUPERRORLOG $command_args"
+	$command $command_args -t  2>/dev/null
+	local ret=$?
+	if [ $ret -eq 0 ]; then
+		user=$($command $command_args -t -D DUMP_RUN_CFG | grep ^User: | cut -d\" -f2)
+		group=$($command $command_args -t -D DUMP_RUN_CFG | grep ^Group: | cut -d\" -f2)
+		checkpath --directory --owner $user:$group --mode 0750 ${pidfile%/*}
+		[ -L $serverroot/run ] && rm $serverroot/run
+		ln -s ${pidfile%/*} $serverroot/run
+		[ -f $serverroot/run/scache ] && rm $serverroot/run/scache
 	else
-		eerror "${RELOAD_TYPE} is not a valid RELOAD_TYPE. Please edit /etc/conf.d/${SVCNAME}"
+		[ -z "$STARTUPERRORLOG" ] && $command $command_args -t
 	fi
+	eend $ret
 }
 
-graceful() {
-	checkconfig || return 1
-	service_started "${SVCNAME}" || return
-	ebegin "Gracefully restarting ${SVCNAME}"
-	${HTTPD} ${HTTPD_OPTS} -k graceful
-	eend $?
-}
-
-gracefulstop() {
-	checkconfig || return 1
-	ebegin "Gracefully stopping ${SVCNAME}"
-	start-stop-daemon --stop --pidfile ${PIDFILE} --exec ${HTTPD} \
-		--retry SIGWINCH/${TIMEOUT}
+reload() {
+	ebegin "Reloading ${SVCNAME}"
+	local signal=HUP
+	[ $RELOAD_TYPE = "graceful" ] && signal=USR1
+	start-stop-daemon --signal $signal --pidfile $pidfile --name $SVCNAME
 	eend $?
 }
-
-modules() {
-	checkconfig || return 1
-
-	${HTTPD} ${HTTPD_OPTS} -M 2>&1
-}
-
-fullstatus() {
-	LYNX="${LYNX:-lynx -dump}"
-	STATUSURL="${STATUSURL:-http://localhost/server-status}"
-
-	if ! service_started "${SVCNAME}"; then
-		eerror "${SVCNAME} not started"
-	elif ! type -p $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then
-		eerror "lynx not installed!"
-	else
-		${LYNX} ${STATUSURL}
-	fi
-}
-
-virtualhosts() {
-	checkconfd || return 1
-	${HTTPD} ${HTTPD_OPTS} -S
-}
-
-configdump() {
-	LYNX="${LYNX:-lynx -dump}"
-	INFOURL="${INFOURL:-http://localhost/server-info}"
-
-	checkconfd || return 1
-
-	if ! service_started "${SVCNAME}"; then
-		eerror "${SVCNAME} not started"
-	elif ! type -p $(set -- ${LYNX}; echo $1) 2>&1 >/dev/null; then
-		eerror "lynx not installed!"
-	else
-		echo "${HTTPD} started with '${HTTPD_OPTS}'"
-		for i in config server list; do
-			${LYNX} "${INFOURL}/?${i}" | sed '/Apache Server Information/d;/^[[:space:]]\+[_]\+$/Q'
-		done
-	fi
-}
-
diff --git a/main/apache2/error.conf b/main/apache2/error.conf
new file mode 100644
index 0000000..5efec7e
--- /dev/null
+++ b/main/apache2/error.conf
@@ -0,0 +1,36 @@
+Alias /error/ "/usr/share/apache2/error/"
+
+<IfModule mod_negotiation.c>
+<IfModule mod_include.c>
+    <Directory "/usr/share/apache2/error">
+        AllowOverride None
+        Options IncludesNoExec
+        AddOutputFilter Includes html
+        AddHandler type-map var
+        #Require all granted
+        Order allow,deny
+        Allow from all
+        LanguagePriority en es de fr
+        ForceLanguagePriority Prefer Fallback
+    </Directory>
+
+    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
+    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
+    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
+    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
+    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
+    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
+    ErrorDocument 410 /error/HTTP_GONE.html.var
+    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
+    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
+    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
+    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
+    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
+    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
+    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
+    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
+    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
+    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
+
+</IfModule>
+</IfModule>
diff --git a/main/apache2/httpd.conf b/main/apache2/httpd.conf
index 1166d8d..c2b0caf 100644
--- a/main/apache2/httpd.conf
+++ b/main/apache2/httpd.conf
@@ -229,9 +229,6 @@ LoadModule alias_module modules/mod_alias.so
 LoadModule rewrite_module modules/mod_rewrite.so
 
 LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
-#LoadModule dav_module modules/mod_dav.so
-#LoadModule dav_fs_module modules/mod_dav_fs.so
-#LoadModule dav_lock_module modules/mod_dav_lock.so
 
 #
 # The following modules are not loaded by default:
@@ -263,7 +260,6 @@ LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
 #LoadModule ssl_module modules/mod_ssl.so
 #LoadModule unique_id_module modules/mod_unique_id.so
 #LoadModule watchdog_module modules/mod_watchdog.so
-#LoadModule xml2enc_module modules/mod_xml2enc.so
 #
 
 #
@@ -581,37 +577,6 @@ CustomLog logs/access.log combined
 ServerSignature On
 
 #
-# Aliases: Add here as many aliases as you need (with no limit). The format is 
-# Alias fakename realname
-#
-# Note that if you include a trailing / on fakename then the server will
-# require it to be present in the URL.  So "/icons" isn't aliased in this
-# example, only "/icons/".  If the fakename is slash-terminated, then the 
-# realname must also be slash terminated, and if the fakename omits the 
-# trailing slash, the realname must also omit it.
-#
-# We include the /icons/ alias for FancyIndexed directory listings.  If you
-# do not use FancyIndexing, you may comment this out.
-#
-Alias /icons/ "/usr/share/apache2/icons/"
-
-<Directory "/usr/share/apache2/icons">
-    Options Indexes MultiViews FollowSymLinks
-    AllowOverride None
-#    Require all granted
-    Order allow,deny
-    Allow from all
-</Directory>
-
-#
-# WebDAV module configuration section.
-# 
-<IfModule mod_dav_fs.c>
-    # Location of the WebDAV lock database.
-    DAVLockDB /var/lib/dav/lockdb
-</IfModule>
-
-#
 # ScriptAlias: This controls which directories contain server scripts.
 # ScriptAliases are essentially the same as Aliases, except that
 # documents in the realname directory are treated as applications and
@@ -899,43 +864,6 @@ AddOutputFilter INCLUDES .shtml
 # copying them to /your/include/path/, even on a per-VirtualHost basis.
 #
 
-Alias /error/ "/usr/share/apache2/error/"
-
-<IfModule mod_negotiation.c>
-<IfModule mod_include.c>
-    <Directory "/usr/share/apache2/error">
-        AllowOverride None
-        Options IncludesNoExec
-        AddOutputFilter Includes html
-        AddHandler type-map var
-        #Require all granted
-        Order allow,deny
-        Allow from all
-        LanguagePriority en es de fr
-        ForceLanguagePriority Prefer Fallback
-    </Directory>
-
-#    ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
-#    ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
-#    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
-#    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
-#    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
-#    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
-#    ErrorDocument 410 /error/HTTP_GONE.html.var
-#    ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
-#    ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
-#    ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
-#    ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
-#    ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
-#    ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
-#    ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
-#    ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
-#    ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
-#    ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
-
-</IfModule>
-</IfModule>
-
 #
 # The following directives modify normal HTTP response behavior to
 # handle known problems with browser implementations.
@@ -947,21 +875,6 @@ BrowserMatch "Java/1\.0" force-response-1.0
 BrowserMatch "JDK/1\.0" force-response-1.0
 
 #
-# The following directive disables redirects on non-GET requests for
-# a directory that does not include the trailing slash.  This fixes a 
-# problem with Microsoft WebFolders which does not appropriately handle 
-# redirects for folders with DAV methods.
-# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
-#
-BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
-BrowserMatch "MS FrontPage" redirect-carefully
-BrowserMatch "^WebDrive" redirect-carefully
-BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
-BrowserMatch "^gnome-vfs/1.0" redirect-carefully
-BrowserMatch "^XML Spy" redirect-carefully
-BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
-
-#
 # Allow server status reports generated by mod_status,
 # with the URL of http://servername/server-status
 # Change the ".example.com" to match your domain to enable.
diff --git a/main/apache2/icons.conf b/main/apache2/icons.conf
new file mode 100644
index 0000000..4fb9679
--- /dev/null
+++ b/main/apache2/icons.conf
@@ -0,0 +1,8 @@
+Alias /icons/ "/usr/share/apache2/icons/"
+
+<Directory "/usr/share/apache2/icons">
+    Options Indexes MultiViews FollowSymLinks
+    AllowOverride None
+    Order allow,deny
+    Allow from all
+</Directory>
diff --git a/main/apache2/proxy-html.conf b/main/apache2/proxy-html.conf
index 90cbf71..890589a 100644
--- a/main/apache2/proxy-html.conf
+++ b/main/apache2/proxy-html.conf
@@ -1 +1,2 @@
 LoadModule proxy_module modules/mod_proxy.so
+LoadModule xml2enc_module modules/mod_xml2enc.so
diff --git a/main/apache2/proxy.conf b/main/apache2/proxy.conf
index a446822..850c632 100644
--- a/main/apache2/proxy.conf
+++ b/main/apache2/proxy.conf
@@ -1,5 +1,4 @@
 # This file configures all the proxy modules:
-LoadModule proxy_module modules/mod_proxy.so
 LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
 LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
 LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
diff --git a/main/apache2/webdav.conf b/main/apache2/webdav.conf
new file mode 100644
index 0000000..f1ca722
--- /dev/null
+++ b/main/apache2/webdav.conf
@@ -0,0 +1,31 @@
+LoadModule dav_module modules/mod_dav.so
+LoadModule dav_fs_module modules/mod_dav_fs.so
+LoadModule dav_lock_module modules/mod_dav_lock.so
+
+<IfModule mod_dav_fs.c>
+
+DAVLockDB /var/www/localhost/webdav/lockdb
+Alias /uploads /var/www/localhost/uploads
+
+<Directory "/var/www/localhost/uploads">
+    Dav On
+    AuthType Digest
+    AuthName DAV-upload
+    AuthUserFile "/var/www/localhost/webdav/user.passwd"
+    AuthDigestProvider file
+    <RequireAny>
+        Require method GET POST OPTIONS
+        Require user admin
+    </RequireAny>
+</Directory>
+
+BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
+BrowserMatch "MS FrontPage" redirect-carefully
+BrowserMatch "^WebDrive" redirect-carefully
+BrowserMatch "^WebDAVFS/1.[01234]" redirect-carefully
+BrowserMatch "^gnome-vfs/1.0" redirect-carefully
+BrowserMatch "^XML Spy" redirect-carefully
+BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
+BrowserMatch " Konqueror/4" redirect-carefully
+
+</IfModule>
-- 
2.6.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---