Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 11, 2012
@ceefour ceefour Static site 42a4a1d
Showing with 53 additions and 0 deletions.
  1. +47 −0 manifests/static.pp
  2. +6 −0 templates/static.erb
View
47 manifests/static.pp
@@ -0,0 +1,47 @@
+# Define: nginx::static
+#
+# Create a static site config from template using parameters.
+#
+# Parameters :
+# * ensure: typically set to "present" or "absent". Defaults to "present"
+# * server_name : server_name directive (an array)
+# * root : filesystem path to document root
+# * listen : address/port the server listen to. Defaults to 80.
+# * access_log : custom acces logs. Defaults to /var/log/nginx/$name_access.log
+#
+# Templates :
+# * nginx/static.erb
+#
+# Sample Usage :
+# nginx::static { 'www.kreasiindonesia.com':
+# server_name => ['www.kreasiindonesia.com', 'kreasiindonesia.com',
+# 'm.kreasiindonesia.com', 'www.m.kreasiindonesia.com',
+# 'skin.kreasiindonesia.com', 'media.kreasiindonesia.com',
+# 'js.kreasiindonesia.com',
+# 'plus.kreasiindonesia.com', 'www.plus.kreasiindonesia.com'],
+# root => '/home/magento/www_maintenance',
+# }
+define nginx::static(
+ $root,
+ $ensure = 'present',
+ $listen = '80',
+ $server_name = undef,
+ $access_log = undef,
+ $status = 'redirect') {
+
+ $real_server_name = $server_name ? {
+ undef => $name,
+ default => $server_name,
+ }
+
+ $real_access_log = $access_log ? {
+ undef => "/var/log/nginx/${name}_access.log",
+ default => $access_log,
+ }
+
+ nginx::site { $name:
+ ensure => $ensure,
+ content => template('nginx/static.erb'),
+ }
+}
+
View
6 templates/static.erb
@@ -0,0 +1,6 @@
+server {
+ listen <%= listen %>;
+ server_name <%= real_server_name.join(' ') %>;
+ access_log <%= real_access_log %>;
+ root <%= root %>;
+}

No commit comments for this range

Something went wrong with that request. Please try again.