title: Dynamic loading of nginx third party module via chef
body: <p>I am trying to dynamically load a third party module to nginx. </p>
  
  <p><a href="https://github.com/stnoonan/spnego-http-auth-nginx-module" rel="nofollow noreferrer">https://github.com/stnoonan/spnego-http-auth-nginx-module</a></p>
  
  <p>Nginx is installed via package installation using chef recipe.</p>
  
  <p>I have tried compiling the module to module binary .so file and copied it to /etc/nginx/modules directory and added the following line into nginx.conf, but it showed error "unknown directive load_module".</p>
  
  <p><strong>nginx.conf</strong></p>
  
  <pre><code>load_module modules/ngx_http_auth_spnego_module.so ;
  </code></pre>
  
  <p><strong>Chef recipe</strong></p>
  
  <pre><code>bash 'create_spnego_module' do
     code &lt;&lt;-EOH
      mkdir -p #{node['nginx']['dir']}/modules
     EOH
   end
  
  cookbook_file "#{node['nginx']['dir']}/modules/ngx_http_auth_spnego_module.so" do
    source 'ngx_http_auth_spnego_module.so'
    owner  'root'
    group  node['root_group']
    mode   '0644'
    notifies :reload, 'service[nginx]', :delayed
  end
  </code></pre>
  
  <p>Is there any other way I can load this module via chef without  recompiling nginx source? </p>