-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vhost_nginx: add new define for redmine virtualhost in nginx web server
- Loading branch information
1 parent
06f30a2
commit 7fef3b2
Showing
2 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# == Define: redmine::vhost_nginx | ||
# | ||
# Generates a vhost for redmine in nginx web server configuration | ||
# | ||
# === Parameters | ||
# | ||
# [*port*] | ||
# port where this vhost should listen | ||
# [*priority*] | ||
# priority of the site configuration file | ||
# [*serveraliases*] | ||
# list of aliases of the vhost | ||
# [*root_dir*] | ||
# root directory of the redmine installation | ||
# [*max_attachment_size*] | ||
# maximum size of the attachment | ||
# | ||
# === Examples | ||
# | ||
# redmine::vhost_nginx { 'redmine.example.net': | ||
# root_dir => '/srv/www/redmine.example.net', | ||
# } | ||
# | ||
# === Authors | ||
# | ||
# Braiins Systems s.r.o. | ||
# | ||
# === Copyright | ||
# | ||
# Copyright 2015 Braiins Systems s.r.o. | ||
# | ||
define redmine::vhost_nginx( | ||
$port='80', | ||
$priority='50', | ||
$max_attachment_size='20M', | ||
$serveraliases=[], | ||
$root_dir, | ||
) { | ||
nginx::vhost { $title: | ||
port => $port, | ||
priority => $priority, | ||
docroot => undef, | ||
create_docroot => false, | ||
template => 'redmine/nginx_redmine_site.conf.erb', | ||
options => { | ||
'serveraliases' => $serveraliases, | ||
'upstream_web' => "upstream-web-puma-redmine-${title}", | ||
'upstream_socket_path' => "${root_dir}/current/tmp/sockets/puma.socket", | ||
'client_max_body_size' => $max_attachment_size, | ||
} | ||
} | ||
} |
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,25 @@ | ||
# Virtual host <%= @name %> | ||
# This file has been provided by puppet for <%= @fqdn %>. | ||
# DON'T EDIT it manually, any changes will be lost | ||
# | ||
|
||
upstream <%= @options['upstream_web'] %> { | ||
server unix:<%= @options['upstream_socket_path'] %>; | ||
} | ||
|
||
server { | ||
listen <%= @port %>; | ||
server_name <%= @name %> <%= @options['serveraliases'].join(" ") %>; | ||
|
||
access_log <%= scope.lookupvar('nginx::log_dir')%>/<%= @title %>.access.log; | ||
error_log <%= scope.lookupvar('nginx::log_dir')%>/<%= @title %>.error.log; | ||
|
||
location / { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_pass http://<%= @options['upstream_web'] %>; | ||
client_max_body_size <%= @options['client_max_body_size'] %>; | ||
client_body_buffer_size 128k; | ||
} | ||
} |