Skip to content

Commit

Permalink
новый параметр fastcgi_intercept_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
melezhik committed Aug 16, 2012
1 parent 6727996 commit b609521
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
3 changes: 2 additions & 1 deletion nginx-fastcgi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ The definition takes the following parameters:
* error_page - specifies custom error pages. Is an Array of Hashes with following keys (check out http://wiki.nginx.org/HttpCoreModule#error_page for details):
* code
* handler

* fastcgi_intercept_errors - specify value for fastcgi_intercept_errors,
check out http://wiki.nginx.org/HttpFastcgiModule#fastcgi_intercept_errors for datails. Default value is false

# Usage cases

Expand Down
1 change: 1 addition & 0 deletions nginx-fastcgi/changes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
0.0.8
===
- new parameter - `error_page`
- new parameter `fastcgi_intercept_errors`
- `static` may be an Array

0.0.7
Expand Down
5 changes: 3 additions & 2 deletions nginx-fastcgi/definitions/nginx_fastcgi.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define :nginx_fastcgi, :servers => [], :root => nil, :static => [], :fastcgi_param => [], :error_page => [] do
define :nginx_fastcgi, :servers => [], :root => nil, :static => [], :fastcgi_param => [], :error_page => [], :fastcgi_intercept_errors => false do

if params[:socket].nil? || params[:socket].empty?
message = 'you should setup socket param. '
Expand Down Expand Up @@ -35,7 +35,8 @@
:servers => params[:servers],
:fastcgi_param => params[:fastcgi_param],
:site_name => File.basename(params[:name]).chomp(File.extname(params[:name])),
:error_page => params[:error_page]
:error_page => params[:error_page],
:fastcgi_intercept_errors => params[:fastcgi_intercept_errors]
})

end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Feature: nginx-fastcgi should be able to set additional fastcgi params

Scenario: install nginx site config
Given I run 'rm -rf /tmp/foo.site.conf'
Then a file named '/tmp/foo.site.conf' should not exist
And I have chef recipe:
"""
nginx_fastcgi '/tmp/foo.site.conf' do
socket '/tmp/application.socket'
servers [
{
:server_name => 'foo.site.x',
}
]
fastcgi_intercept_errors true
end
"""
When I run chef recipe on my node
Then a file named '/tmp/foo.site.conf' should exist
And a file named '/tmp/foo.site.conf' should contain 'fastcgi_intercept_errors on;'



4 changes: 4 additions & 0 deletions nginx-fastcgi/templates/default/nginx-site.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ server {
<%- @fastcgi_param.each do |f| %>
fastcgi_param <%= f[:name] %> <%= f[:value] %>;
<%- end %>
<%- if @fastcgi_intercept_errors == true %>
fastcgi_intercept_errors on;
<%- end %>

}
<%- else %>
rewrite ^ <%= s[:redirect] %>://$server_name$request_uri? permanent;
Expand Down

0 comments on commit b609521

Please sign in to comment.