Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifests/package/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
# This class file is not called directly
class nginx::package::debian {
$operatingsystem_lowercase = inline_template('<%= operatingsystem.downcase %>')
$operatingsystem_lowercase = inline_template('<%= @operatingsystem.downcase %>')

package { 'nginx':
ensure => present,
Expand Down
12 changes: 6 additions & 6 deletions templates/conf.d/nginx.conf.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
user <%= scope.lookupvar('nginx::config::nx_daemon_user') %>;
worker_processes <%= worker_processes %>;
worker_processes <%= @worker_processes %>;

error_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/error.log;
pid <%= scope.lookupvar('nginx::params::nx_pid')%>;

events {
worker_connections <%= worker_connections -%>;
worker_connections <%= @worker_connections -%>;
<% if scope.lookupvar('nginx::params::nx_multi_accept') == 'on' %>multi_accept on;<% end -%>
<% if scope.lookupvar('nginx::params::nx_events_use') %>use <%= scope.lookupvar('nginx::params::nx_events_use')%>;<% end -%>
}
Expand All @@ -18,7 +18,7 @@ http {

sendfile <%= scope.lookupvar('nginx::params::nx_sendfile')%>;

server_tokens <%= server_tokens %>;
server_tokens <%= @server_tokens %>;
<% if scope.lookupvar('nginx::params::nx_tcp_nopush') == 'on' %>tcp_nopush on;<% end %>

types_hash_max_size <%= scope.lookupvar('nginx::params::nx_types_hash_max_size')%>;
Expand All @@ -29,13 +29,13 @@ http {
keepalive_timeout <%= scope.lookupvar('nginx::params::nx_keepalive_timeout')%>;
tcp_nodelay <%= scope.lookupvar('nginx::params::nx_tcp_nodelay')%>;

<% if scope.lookupvar('nginx::params::nx_gzip') == 'on' %>
<% if scope.lookupvar('nginx::params::nx_gzip') == 'on' %>
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
<% end -%>

<% if proxy_cache_path -%>
proxy_cache_path <%= proxy_cache_path %> levels=<%= proxy_cache_levels %> keys_zone=<%= proxy_cache_keys_zone %> max_size=<%= proxy_cache_max_size %> inactive=<%= proxy_cache_inactive %>;
<% if @proxy_cache_path -%>
proxy_cache_path <%= @proxy_cache_path %> levels=<%= @proxy_cache_levels %> keys_zone=<%= @proxy_cache_keys_zone %> max_size=<%= @proxy_cache_max_size %> inactive=<%= @proxy_cache_inactive %>;
<% end -%>

include /etc/nginx/conf.d/*.conf;
Expand Down
2 changes: 1 addition & 1 deletion templates/conf.d/proxy.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ proxy_send_timeout <%= scope.lookupvar('nginx::params::nx_proxy_send_timeou
proxy_read_timeout <%= scope.lookupvar('nginx::params::nx_proxy_read_timeout') %>;
proxy_buffers <%= scope.lookupvar('nginx::params::nx_proxy_buffers') %>;
proxy_http_version <%= @proxy_http_version %>;
<% proxy_set_header.each do |header| %>
<% @proxy_set_header.each do |header| %>
proxy_set_header <%= header %>;<% end %>
4 changes: 2 additions & 2 deletions templates/conf.d/upstream.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
upstream <%= name %> {
upstream <%= @name %> {
<% if @upstream_cfg_prepend -%><% upstream_cfg_prepend.sort_by{|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;<% end -%><% end -%>
<% members.each do |i| %>
<% @members.each do |i| %>
server <%= i %>;<% end %>
}
8 changes: 4 additions & 4 deletions templates/vhost/vhost_footer.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ include <%= file %>;
<% end -%>
<% end -%>
}
<% if rewrite_www_to_non_www -%>
<% if @rewrite_www_to_non_www -%>
server {
listen <%= listen_ip %>;
server_name www.<%= name.gsub(/^www\./, '') %>;
rewrite ^ http://<%= name.gsub(/^www\./, '') %>$uri permanent;
listen <%= @listen_ip %>;
server_name www.<%= @name.gsub(/^www\./, '') %>;
rewrite ^ http://<%= @name.gsub(/^www\./, '') %>$uri permanent;
}
<% end %>
16 changes: 8 additions & 8 deletions templates/vhost/vhost_header.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
server {
listen <%= listen_ip %>:<%= listen_port %><% if @listen_options %> <%= listen_options %><% end %>;
listen <%= @listen_ip %>:<%= @listen_port %><% if @listen_options %> <%= @listen_options %><% end %>;
<% # check to see if ipv6 support exists in the kernel before applying %>
<% if ipv6_enable == 'true' && (defined? ipaddress6) %>
listen [<%= ipv6_listen_ip %>]:<%= ipv6_listen_port %> <% if @ipv6_listen_options %><%= ipv6_listen_options %><% end %> ipv6only=on;
<% if @ipv6_enable == 'true' && (defined? ipaddress6) %>
listen [<%= ipv6_listen_ip %>]:<%= @ipv6_listen_port %> <% if @ipv6_listen_options %><%= @ipv6_listen_options %><% end %> ipv6only=on;
<% end %>
server_name <%= rewrite_www_to_non_www ? name.gsub(/^www\./, '') : server_name.join(" ") %>;
access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/<%= name %>.access.log;
server_name <%= @rewrite_www_to_non_www ? @name.gsub(/^www\./, '') : @server_name.join(" ") %>;
access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/<%= @name %>.access.log;
<% if defined? auth_basic -%>
auth_basic "<%= auth_basic %>";
auth_basic "<%= @auth_basic %>";
<% end -%>
<% if defined? auth_basic_user_file -%>
auth_basic_user_file <%= auth_basic_user_file %>;
auth_basic_user_file <%= @auth_basic_user_file %>;
<% end -%>

<% proxy_set_header.each do |header| -%>
<% @proxy_set_header.each do |header| -%>
proxy_set_header <%= header %>;
<% end -%>
<% if @rewrite_to_https -%>
Expand Down
8 changes: 4 additions & 4 deletions templates/vhost/vhost_location_alias.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
location <%= location %> {
<% if @location_cfg_prepend -%><% location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
location <%= @location %> {
<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;<% end -%><% end -%>
alias <%= location_alias %>;
<% if @location_cfg_append -%><% location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
alias <%= @location_alias %>;
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;<% end -%><% end -%>
}
19 changes: 9 additions & 10 deletions templates/vhost/vhost_location_directory.erb
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
location <%= location %> {
<% if @location_cfg_prepend -%><% location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
location <%= @location %> {
<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;
<% end -%><% end -%>
root <%= www_root %>;
root <%= @www_root %>;
<% if @try_files -%>
try_files <% try_files.each do |try| -%> <%= try %> <% end -%>;
try_files <% @try_files.each do |try| -%> <%= try %> <% end -%>;
<% end -%>
<% if index_files -%>
index <% index_files.each do |i| %> <%= i %><% end %>;
<% if @index_files -%>
index <% @index_files.each do |i| %> <%= i %><% end %>;
<% end -%>
<% if defined? auth_basic -%>
auth_basic "<%= auth_basic %>";
auth_basic "<%= @auth_basic %>";
<% end -%>
<% if defined? auth_basic_user_file -%>
auth_basic_user_file <%= auth_basic_user_file %>;
auth_basic_user_file <%= @auth_basic_user_file %>;
<% end -%>
<% if @location_cfg_append -%><% location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;
<% end -%><% end -%>
}

4 changes: 2 additions & 2 deletions templates/vhost/vhost_location_empty.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
location <%= location %> {
<% location_custom_cfg.sort_by {|k,v| k}.each do |key,value| -%>
location <%= @location %> {
<% @location_custom_cfg.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;
<% end -%>
}
13 changes: 6 additions & 7 deletions templates/vhost/vhost_location_fastcgi.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
location <%= location %> {
root <%= www_root %>;
include <%= fastcgi_params %>;
fastcgi_pass <%= fastcgi %>;
<% unless fastcgi_script == :undef %>
fastcgi_param SCRIPT_FILENAME <%= fastcgi_script %>;
location <%= @location %> {
root <%= @www_root %>;
include <%= @fastcgi_params %>;
fastcgi_pass <%= @fastcgi %>;
<% unless @fastcgi_script == :undef %>
fastcgi_param SCRIPT_FILENAME <%= @fastcgi_script %>;
<% end -%>
}

16 changes: 8 additions & 8 deletions templates/vhost/vhost_location_proxy.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
location <%= location %> {
<% if @location_cfg_prepend -%><% location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
location <%= @location %> {
<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;
<% end -%><% end -%>
<% if proxy_cache -%>
proxy_cache <%= proxy_cache %>;
proxy_cache_valid <%= proxy_cache_valid %>;
<% if @proxy_cache -%>
proxy_cache <%= @proxy_cache %>;
proxy_cache_valid <%= @proxy_cache_valid %>;
<% end -%>
proxy_pass <%= proxy %>;
proxy_read_timeout <%= proxy_read_timeout %>;
<% if @location_cfg_append -%><% location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
proxy_pass <%= @proxy %>;
proxy_read_timeout <%= @proxy_read_timeout %>;
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;
<% end -%><% end -%>
}
6 changes: 3 additions & 3 deletions templates/vhost/vhost_location_stub_status.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
location <%= location %> {
<% if @location_cfg_prepend -%><% location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
location <%= @location %> {
<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;<% end -%><% end -%>
stub_status on;
<% if @location_cfg_append -%><% location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;<% end -%><% end -%>
}
29 changes: 14 additions & 15 deletions templates/vhost/vhost_ssl_header.erb
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
server {
listen <%= listen_ip %>:<%= ssl_port %> ssl<% if spdy == 'on' %> spdy<% end %><% if @listen_options %><%= listen_options %><% end %>;
<% if ipv6_enable == 'true' && (defined? ipaddress6) %>
listen [<%= ipv6_listen_ip %>]:<%= ipv6_listen_port %> <% if @ipv6_listen_options %><%= ipv6_listen_options %><% end %> ipv6only=on;
listen <%= @listen_ip %>:<%= @ssl_port %> ssl<% if @spdy == 'on' %> spdy<% end %><% if @listen_options %><%= @listen_options %><% end %>;
<% if @ipv6_enable == 'true' && (defined? ipaddress6) %>
listen [<%= @ipv6_listen_ip %>]:<%= @ipv6_listen_port %> <% if @ipv6_listen_options %><%= @ipv6_listen_options %><% end %> ipv6only=on;
<% end %>
server_name <%= rewrite_www_to_non_www ? name.gsub(/^www\./, '') : server_name.join(" ") %>;
server_name <%= @rewrite_www_to_non_www ? @name.gsub(/^www\./, '') : @server_name.join(" ") %>;

ssl on;

ssl_certificate <%= scope.lookupvar('nginx::params::nx_conf_dir') %>/<%= name.gsub(' ', '_') %>.crt;
ssl_certificate_key <%= scope.lookupvar('nginx::params::nx_conf_dir') %>/<%= name.gsub(' ', '_') %>.key;
ssl_certificate <%= scope.lookupvar('nginx::params::nx_conf_dir') %>/<%= @name.gsub(' ', '_') %>.crt;
ssl_certificate_key <%= scope.lookupvar('nginx::params::nx_conf_dir') %>/<%= @name.gsub(' ', '_') %>.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_protocols <%= ssl_protocols %>;
ssl_ciphers <%= ssl_ciphers %>;
ssl_protocols <%= @ssl_protocols %>;
ssl_ciphers <%= @ssl_ciphers %>;
ssl_prefer_server_ciphers on;
<% if auth_basic != :undef -%>
auth_basic "<%= auth_basic %>";
<% if @auth_basic != :undef -%>
auth_basic "<%= @auth_basic %>";
<% end -%>
<% if auth_basic_user_file != :undef -%>
auth_basic_user_file <%= auth_basic_user_file %>;
<% if @auth_basic_user_file != :undef -%>
auth_basic_user_file <%= @auth_basic_user_file %>;
<% end -%>

access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/ssl-<%= name.gsub(' ', '_') %>.access.log;
error_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/ssl-<%= name.gsub(' ', '_') %>.error.log;

access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/ssl-<%= @name.gsub(' ', '_') %>.access.log;
error_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/ssl-<%= @name.gsub(' ', '_') %>.error.log;