How to enable WebDAV module and add nginx-dav-ext-module support for Nginx web server

Notes:
  1. Below guide has only been tested on CentOS 6.x only for adding HTTP and WebDAV module support to Nginx.
  2. Read below web site links for how to properly configure it in your Nginx vhosts.
  3. Below guide will allow any subsequent Nginx upgrade, downgrade recompiles via centmin.sh menu option #4 to enable WebDAV and add nginx-dav-ext-module support.
  4. Benefits of compiling and installing Nginx from source versus RPM package updates are:
    • More flexibility in adding whatever modules you want to Nginx without relying on what is available via YUM repos. Once you understand the process below, you can further extend Nginx web server with whatever Nginx modules you want regardless of whether they are available or not in official YUM repos and still maintain the easy to use Nginx upgrade/downgrade feature via centmin.sh menu option #4.
    • If for some reason an Nginx module has a bug or issue, you can easily reverse the change via the below process and remove the --with-http_dav_module and --add-module=../nginx-dav-ext-module-0.0.2 options and re-run centmin.sh menu option #4 to recompile Nginx without the module.
    • Basically with source compiles, you'd have less reliance on YUM package developer or Centmin Mod developer's assistance with extending your Nginx web server. It is the main reason Centmin Mod is scripted the way it is for control and flexibility in configuration.

Required reading for Nginx with WebDAV support:

1. For CentOS 6.x install expat and expat-devel packages

  yum -y install expat expat-devel

2. Download nginx-dav-ext-module from https://github.com/arut/nginx-dav-ext-module/archive/v0.0.2.zip to /svr-setup and rename v0.0.2.zip to nginx-dav-ext-module-v0.0.2.zip.

  cd /svr-setup
  wget -c https://github.com/arut/nginx-dav-ext-module/archive/v0.0.2.zip -O nginx-dav-ext-module-v0.0.2.zip

3. Unzip nginx-dav-ext-module-v0.0.2.zip.

  cd /svr-setup
  unzip nginx-dav-ext-module-v0.0.2.zip

You'll find extracted directory at /svr-setup/nginx-dav-ext-module-0.0.2 take note of that directory as you'll need it for nginx configure option --add-module=../nginx-dav-ext-module-0.0.2

4. Edit inc/nginx_configure.inc to modify Nginx source configure options to add --with-http_dav_module and --add-module=../nginx-dav-ext-module-0.0.2 option.

  --with-http_dav_module --add-module=../nginx-dav-ext-module-0.0.2

For v1.2.2-eva2000.21

from

      ASK "Would you like to compile nginx with IPv6 support? [y/n] "
    if [[ "$key" = [yY] ]]; then

./configure --sbin-path=/usr/local/sbin --conf-path=/usr/local/nginx/conf/nginx.conf --with-ipv6 --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-1.6 --add-module=../nginx-accesskey-2.0.3${GPERFOPT}${OPENSSLOPT} --with-openssl-opt="enable-tlsext"

    else

./configure --sbin-path=/usr/local/sbin --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-1.6 --add-module=../nginx-accesskey-2.0.3${GPERFOPT}${OPENSSLOPT} --with-openssl-opt="enable-tlsext"
    fi   

to

      ASK "Would you like to compile nginx with IPv6 support? [y/n] "
    if [[ "$key" = [yY] ]]; then

./configure --sbin-path=/usr/local/sbin --conf-path=/usr/local/nginx/conf/nginx.conf --with-ipv6 --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --with-http_dav_module --add-module=../nginx-dav-ext-module-0.0.2 --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-1.6 --add-module=../nginx-accesskey-2.0.3${GPERFOPT}${OPENSSLOPT} --with-openssl-opt="enable-tlsext"

    else

./configure --sbin-path=/usr/local/sbin --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --with-http_dav_module --add-module=../nginx-dav-ext-module-0.0.2 --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-1.6 --add-module=../nginx-accesskey-2.0.3${GPERFOPT}${OPENSSLOPT} --with-openssl-opt="enable-tlsext"
    fi   

For v1.2.3-eva2000.01

from

  #    ASK "Would you like to compile nginx with IPv6 support? [y/n] "
    if [[ "$asknginxipv" = [yY] ]]; then

./configure --sbin-path=/usr/local/sbin --conf-path=/usr/local/nginx/conf/nginx.conf --with-ipv6 --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-2.1 --add-module=../nginx-accesskey-2.0.3${GPERFOPT}${OPENSSLOPT} --add-module=../nginx-http-concat-master --with-openssl-opt="enable-tlsext"

    else

./configure --sbin-path=/usr/local/sbin --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-2.1 --add-module=../nginx-accesskey-2.0.3${GPERFOPT}${OPENSSLOPT} --add-module=../nginx-http-concat-master --with-openssl-opt="enable-tlsext"
    fi   

to

  #    ASK "Would you like to compile nginx with IPv6 support? [y/n] "
    if [[ "$asknginxipv" = [yY] ]]; then

./configure --sbin-path=/usr/local/sbin --conf-path=/usr/local/nginx/conf/nginx.conf --with-ipv6 --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --with-http_dav_module --add-module=../nginx-dav-ext-module-0.0.2 --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-2.1 --add-module=../nginx-accesskey-2.0.3${GPERFOPT}${OPENSSLOPT} --add-module=../nginx-http-concat-master --with-openssl-opt="enable-tlsext"

    else

./configure --sbin-path=/usr/local/sbin --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --with-http_dav_module --add-module=../nginx-dav-ext-module-0.0.2 --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-2.1 --add-module=../nginx-accesskey-2.0.3${GPERFOPT}${OPENSSLOPT} --add-module=../nginx-http-concat-master --with-openssl-opt="enable-tlsext"
    fi   

5. Time to recompile Nginx via centmin.sh menu option #4.

i.e. For v1.2.3-eva2000.01

  cd /usr/local/src/centmin-v1.2.3mod/
  ./centmin.sh

Note: can skip YUM install check and skip OpenSSL recompile by answering NO at prompt = n.

6. Once Nginx recompiled, check Nginx configure options via command:

  nginx -V

Looking for addition of these 2 entries

  --with-http_dav_module --add-module=../nginx-dav-ext-module-0.0.2

  nginx version: nginx/1.2.8
built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) 
TLS SNI support enabled
configure arguments: --sbin-path=/usr/local/sbin --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_secure_link_module --with-http_flv_module --with-http_realip_module --with-http_dav_module --add-module=../nginx-dav-ext-module-0.0.2 --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-2.0 --add-module=../nginx-accesskey-2.0.3 --with-openssl=../openssl-1.0.0e --add-module=../nginx-http-concat-master --with-openssl-opt=enable-tlsext