Skip to content

Commit

Permalink
nginx: you can define multiple location blocks now in nginx::site::proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
daks committed Jan 2, 2012
1 parent 4caeab6 commit dc0638f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
8 changes: 3 additions & 5 deletions nginx/README
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@ nginx::site::proxy
port (optional, default: 80):
its port

location_url (optional):
url for a location block

location_content (optional):
content of this location block
location_blocks (optional):
an hash { $url1 => $content1, $url2 => $content2 } to define blocks like
location $url1 { $content1 }

default_vhost (optional, default: false):
is this vhost the default one?
Expand Down
3 changes: 1 addition & 2 deletions nginx/manifests/site/proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
$port='80',
$upstream='',
$root_dir='',
$location_url='',
$location_content='',
$location_blocks={},
$default_vhost=false,
$enabled=true) {

Expand Down
8 changes: 4 additions & 4 deletions nginx/templates/proxy.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ server {

root <%= root_dir %>;

<% if location_url != "" then %>
location <%= location_url %> {
<%= location_content %>
<% location_blocks.each_pair do |url, content| %>
location <%= url %> {
<%= content %>
}

<% end %>

location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
Expand Down

0 comments on commit dc0638f

Please sign in to comment.