Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

...
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 11, 2012
Hendy Irawan ceefour Static site 42a4a1d
Showing with 53 additions and 0 deletions.
  1. +47 −0 manifests/static.pp
  2. +6 −0 templates/static.erb
47 manifests/static.pp
View
@@ -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'),
+ }
+}
+
6 templates/static.erb
View
@@ -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.