-
-
Notifications
You must be signed in to change notification settings - Fork 878
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize templates for clearer understanding (#970)
Without this change, the structure of the templates for locations are bit rigid and hard to understand. Each component of a location uses an isolated template which means that much of the common logic is hard coded to a particular location style, the deployment of which is chosen based on a somewhat arbitrary idea of what it means to be a location, and in some cases, the module gets it wrong. In cases where there is seeming correctness, modifications to a particular selection of logic are duplicated among the nested templates. This work is the results of what was necessary for me to understand what the templates were doing, and to deploy a fastcgi PHP application. As such, the templates have been centralized and conditions about their functionality have been moved into the template to determine if rendering needs to be taken. This allows a more complete, and leaves potential for more complex examples easier to understand and reason about. Also here is the addition of a new param fastcgi_index on the location class. This work should result in on-disk configurations that are functionally equivalent to what was in place before, except in places where the module was masking conflicting options that were not being rendered in the templates.
- Loading branch information
Showing
8 changed files
with
31 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<%= scope.function_template(['nginx/vhost/location_header.erb']) -%> | ||
<%= scope.function_template(['nginx/vhost/locations/alias.erb']) -%> | ||
<%= scope.function_template(['nginx/vhost/locations/stub_status.erb']) -%> | ||
<% if @fastcgi or @uwsgi or @proxy -%> | ||
<%= scope.function_template(['nginx/vhost/locations/proxy.erb']) -%> | ||
<%= scope.function_template(['nginx/vhost/locations/uwsgi.erb']) -%> | ||
<%= scope.function_template(['nginx/vhost/locations/fastcgi.erb']) -%> | ||
<% else -%> | ||
<%= scope.function_template(['nginx/vhost/locations/directory.erb']) -%> | ||
<% end -%> | ||
<%= scope.function_template(['nginx/vhost/locations/try_files.erb']) -%> | ||
<%= scope.function_template(['nginx/vhost/locations/empty.erb']) -%> | ||
<%= scope.function_template(['nginx/vhost/location_footer.erb']) -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,3 @@ | ||
<% if @location_alias -%> | ||
alias <%= @location_alias %>; | ||
<% if defined? @autoindex -%> | ||
autoindex <%= @autoindex %>; | ||
<% end -%> | ||
<% if @index_files and @index_files.count > 0 -%> | ||
index <% Array(@index_files).each do |i| %> <%= i %><% end %>; | ||
<% end -%> | ||
<% if @try_files -%> | ||
try_files<% @try_files.each do |try| -%> <%= try %><% end -%>; | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
<% if @stub_status -%> | ||
stub_status on; | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters