Skip to content

Commit

Permalink
* Option fastcgi_script fixed
Browse files Browse the repository at this point in the history
* Options location_cfg_append and location_cfg_prepend added to fastcgi template
* Option www_root is optional now
* Options logging fixed in http template
* Auth_basic fixed in SSL vhost header
  • Loading branch information
abraham1901 committed Jul 31, 2013
1 parent 5522f27 commit 49b5b79
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 5 deletions.
8 changes: 8 additions & 0 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@
$content_real = template('nginx/vhost/vhost_location_empty.erb')
}

if $fastcgi != undef and !defined(File['/etc/nginx/fastcgi_params']) {
file { '/etc/nginx/fastcgi_params':
ensure => present,
mode => '0770',
content => template('nginx/vhost/fastcgi_params.erb'),
}
}

## Create stubs for vHost File Fragment Pattern
if ($ssl_only != true) {
file {"${nginx::config::nx_temp_dir}/nginx.d/${vhost}-${priority}-${name}":
Expand Down
8 changes: 8 additions & 0 deletions manifests/resource/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@
location_cfg_append => $location_cfg_append }
}

if $fastcgi != undef and !defined(File['/etc/nginx/fastcgi_params']) {
file { '/etc/nginx/fastcgi_params':
ensure => present,
mode => '0770',
content => template('nginx/vhost/fastcgi_params.erb'),
}
}

# Create a proper file close stub.
if ($listen_port != $ssl_port) {
file { "${nginx::config::nx_temp_dir}/nginx.d/${name}-699": content => template('nginx/vhost/vhost_footer.erb'), }
Expand Down
6 changes: 4 additions & 2 deletions templates/vhost/vhost_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ server {
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;
<% if defined? auth_basic -%>
auth_basic "<%= @auth_basic %>";
<% end -%>
<% if defined? auth_basic_user_file -%>
auth_basic_user_file <%= @auth_basic_user_file %>;
<% end -%>

<% @proxy_set_header.each do |header| -%>
proxy_set_header <%= header %>;
<% end -%>
Expand All @@ -21,3 +19,7 @@ server {
return 301 https://$host$request_uri;
}
<% end -%>

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

1 change: 1 addition & 0 deletions templates/vhost/vhost_location_alias.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;<% end -%><% end -%>
}

3 changes: 3 additions & 0 deletions templates/vhost/vhost_location_directory.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;
<% end -%><% end -%>
<% if defined? @www_root -%>
root <%= @www_root %>;
<% end -%>
<% if @try_files -%>
try_files <% @try_files.each do |try| -%> <%= try %> <% end -%>;
<% end -%>
Expand All @@ -19,3 +21,4 @@
<%= key %> <%= value %>;
<% end -%><% end -%>
}

1 change: 1 addition & 0 deletions templates/vhost/vhost_location_empty.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
<%= key %> <%= value %>;
<% end -%><% end -%>
}

11 changes: 10 additions & 1 deletion templates/vhost/vhost_location_fastcgi.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
location <%= @location %> {
<% if @location_cfg_prepend -%><% @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;
<% end -%><% end -%>
<% if defined? @www_root -%>
root <%= @www_root %>;
<% end -%>
include <%= @fastcgi_params %>;
fastcgi_pass <%= @fastcgi %>;
<% unless @fastcgi_script == :undef %>
<% if defined? @fastcgi_script %>
fastcgi_param SCRIPT_FILENAME <%= @fastcgi_script %>;
<% end -%>
<% if @location_cfg_append -%><% @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%>
<%= key %> <%= value %>;
<% end -%><% end -%>
}

1 change: 1 addition & 0 deletions templates/vhost/vhost_location_proxy.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
<%= key %> <%= value %>;
<% end -%><% end -%>
}

1 change: 1 addition & 0 deletions templates/vhost/vhost_location_stub_status.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
<% 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_ssl_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ server {
ssl_protocols <%= @ssl_protocols %>;
ssl_ciphers <%= @ssl_ciphers %>;
ssl_prefer_server_ciphers on;
<% if @auth_basic != :undef -%>
<% if defined? @auth_basic -%>
auth_basic "<%= @auth_basic %>";
<% end -%>
<% if @auth_basic_user_file != :undef -%>
<% if defined? @auth_basic_user_file -%>
auth_basic_user_file <%= @auth_basic_user_file %>;
<% end -%>

Expand Down

0 comments on commit 49b5b79

Please sign in to comment.