DirectAdmin Knowledge Base and Support

DirectAdmin is a web panel for a simple administration of both virtual and dedicated servers. DirectAdmin is faster, safe and more powerful than any other CP. And we know how to customize and support it.

WebDAV support with nginx+apache on Directadmin powered server

| 21:13:28 26.11.2014

*** Last updated on Dec 06, 2017 ***

So you decided to add a WebDAV support into NGINX or Apache on Directadmin server with Custombuild 2.x. Here you can find a basic guide on how to achieve it. First of all please keep in mind, that:

  • Apache is already built with WebDAV support if you install it with custombuild on a Directadmin server. 
  • NGINX is built by Directadmin with ngx_http_dav_module module, so it support WebDAV protocol too. The ngx_http_dav_module module is intended for file management automation via the WebDAV protocol. The module processes HTTP and WebDAV methods PUT, DELETE, MKCOL, COPY, and MOVE. See http://nginx.org/en/docs/http/ngx_http_dav_module.html for more details.

IMPORTANT: NGINX should be built with nginx-dav-ext-module if you want it to support WebDAV methods PROPFIND & OPTIONS which are missing by default. This guide does not cover this aspect.

That's all. Now we need to update settings and configs, and here is how you can do it:

*** New way (since Autumn 2017) ***

Enabling WebDAV methods in NGINX/Apache

The recent update of custombuild (v2.x) makes the things easier for changing. Please note you can now find

http_methods=GET:HEAD:POST

in /usr/local/directadmin/custombuild/options.conf. If it's missing then you could try and run 

cd /usr/local/directadmin/custombuild/
./build update

to download the latest custombuild version and update list of options.

Control it with the following commands:

# cd /usr/local/directadmin/custombuild/
# grep GET options.conf
http_methods=GET:HEAD:POST

Now it's time to enable desired methods, use the following command:

./build set http_methods GET:HEAD:POST:PROPFIND:OPTIONS:PUT:DELETE:MKCOL:COPY:MOVE:REPORT

and rewrite configs 

cd /usr/local/directadmin/custombuild && ./build rewrite_confs

in order to get all the changes applied.

That's it.


*** Old way ***

Updating NGINX configuration

To add a support for WebDAV, CardDav, CalDav in NGINX on a server with Directadmin and Custombuild 2.x you should modify files:

/etc/nginx/webapps.conf
/etc/nginx/webapps.hostname.conf
/etc/nginx/webapps.ssl.conf

They contain the following code:

if ($request_method !~ ^(GET|HEAD|POST)$ ) {
        return 444;
}

So the lines should be changed to

if ($request_method !~ ^(GET|HEAD|POST|PROPFIND|OPTIONS|PUT|DELETE|MKCOL|COPY|MOVE|REPORT)$ ) {
        return 444;
}


Updating Apache configuration

Apache (from CustomBuild/Directamin) is configured to allow only GET, POST, OPTIONS, PROPFIND methods by default, so you need to update the following files:

/etc/httpd/conf/extra/httpd-directories-new.conf
/etc/httpd/conf/extra/httpd-directories-old.conf

Update the lines:

        <Limit GET POST OPTIONS PROPFIND>
                Order allow,deny
                Allow from all
        </Limit>
        <LimitExcept GET POST OPTIONS PROPFIND>
                Order deny,allow
                Deny from all
        </LimitExcept>

to:

        <Limit GET POST OPTIONS PROPFIND HEAD PUT DELETE MKCOL COPY MOVE REPORT>
                Order allow,deny
                Allow from all
        </Limit>
        <LimitExcept GET POST OPTIONS PROPFIND HEAD PUT DELETE MKCOL COPY MOVE REPORT>
                Order deny,allow
                Deny from all
        </LimitExcept>

save changes and restart Apache.


Protecting your changes from being overwritten

After you modified the files:

/etc/nginx/webapps.conf
/etc/nginx/webapps.hostname.conf
/etc/nginx/webapps.ssl.conf

you need to copy them into

/usr/local/directadmin/custombuild/custom/nginx/conf/webapps.conf
/usr/local/directadmin/custombuild/custom/nginx/conf/webapps.hostname.conf
/usr/local/directadmin/custombuild/custom/nginx/conf/webapps.ssl.conf

Note, currently it's still custom/nginx/conf even if you use nginx_apache. And you won't see the files in either
/usr/local/directadmin/custombuild/configure/nginx_reverse/conf/
or /usr/local/directadmin/custombuild/custom/nginx_reverse/conf/.

And Apache's files that you changed should be copied to /usr/local/directadmin/custombuild/custom/ap2/conf/extra/

About Us
We are a team of professionals, and specialize in installation, configuring and managing of remote virtual and dedicated servers powered by Linux/Unix-like OS with DirectAdmin. We support various sets of software, including web-servers Apache, Nginx; internet domain name servers Bind, PowerDNS; mail-servers with POP3, IMAP and SMTP, FTP-servers, etc. After years of working through the most complex server challenges our team has gathered valuable experience and universal solutions suitable for everyday tasks. We are here to lend you a helping hand and take care of your servers in order to let you have enough time to do more of what you love.




All of the information and data on this site is for informational purposes only and is provided for the convenience of the user.
Powered by: Amiro.CMS - Free edition