download the nginx souce .tar.gz (http://nginx.org/en/download.html) download the source for a module you would like to add (must be built in at compile time)
http://wiki.nginx.org/HttpEchoModule https://github.com/agentzh/echo-nginx-module
http://www.evanmiller.org/nginx-modules-guide.html#overview
http://wiki.nginx.org/InstallOptions
./configure --prefix=/opt/nginx-1.4.2 --conf-path=/etc/nginx/nginx.conf --with-debug --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_realip_module -- add-module=/usr/local/src/echo-nginx-module-0.49 --add-module=/usr/local/src/ngx_aws_auth
sudo make sudo make install
/opt/nginx-1.4.2/sbin/nginx -V nginx version: nginx/1.4.2 built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) TLS SNI support enabled configure arguments: --prefix=/opt/nginx-1.4.2 --conf-path=/etc/nginx/nginx.conf --with-debug --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_realip_module --add-module=/usr/local/src/echo-nginx-module-0.49 --add-module=/usr/local/src/ngx_aws_auth
https://github.com/opscode-cookbooks/nginx
node.set[:nginx][:install_path] = "/opt/nginx-#{nginx_version}" node.set[:nginx][:src_binary] = "#{node[:nginx][:install_path]}/sbin/nginx" node.set[:nginx][:daemon_disable] = true node.set[:nginx][:configure_flags] = [ "--prefix=#{node[:nginx][:install_path]}", "--conf-path=#{node[:nginx][:dir]} /nginx.conf", "--with-http_ssl_module", "--with-http_gzip_static_module", "--with-http_stub_status_module", "--with-http_realip_module", "--add-module=../headers-more-nginx-module-#{headers_more_version}", "--add-module=../echo-nginx-module-0.49" ]
bash "compile_nginx_source" do
cwd Chef::Config[:file_cache_path]
code <<-EOH
set -e
tar zxf nginx-#{nginx_version}.tar.gz
tar zxf headers-more-nginx-module-#{headers_more_version}.tar.gz
cd nginx-#{nginx_version} && ./configure #{configure_flags}
make && make install
EOH
not_if do
if !File.exist?(nginx_src_bin)
false
else
nginx_v = #{nginx_src_bin} -V 2>&1
nginx_v =~ /nginx\/#{nginx_version}/ && nginx_v =~ /headers-more/
end
end
end
directory node[:nginx][:log_dir] do mode 0755 owner node[:nginx][:user] action :create end
directory node[:nginx][:dir] do owner "root" group "root" mode "0755" end
sudo vi /etc/nginx/sites-available/000-web
location /john { echo "hi"; echo $request_uri; }
--with-debug
error_log /var/log/nginx/debugerror.log debug;
2013/11/25 18:22:41 [debug] 15781#0: 7 http cl:-1 max:57671680 2013/11/25 18:22:41 [debug] 15781#0: 7 rewrite phase: 3 2013/11/25 18:22:41 [debug] 15781#0: 7 http script var 2013/11/25 18:22:41 [debug] 15781#0: 7 http script var: "GET" 2013/11/25 18:22:41 [debug] 15781#0: 7 http script regex: "^(GET|HEAD)$" 2013/11/25 18:22:41 [notice] 15781#0: 7 "^(GET|HEAD)$" matches "GET", client: 10.10.10.232, server: , request: "GET /Files/1%2F1%2F15aYG8Q34NTkZqU%2Fshelby%2Bplus.png HTTP/1.1", host: "dhcp135.example.com", referrer: "https://dhcp135.example.com/20?or_find=prev" 2013/11/25 18:22:41 [debug] 15781#0: 7 http script if 2013/11/25 18:22:41 [debug] 15781#0: 7 http script if: false 2013/11/25 18:22:41 [debug] 15781#0: *7 rewrite phase: 4