Created
November 4, 2013 23:23
-
-
Save dougmarcey/7311097 to your computer and use it in GitHub Desktop.
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
class hbs::nginxdrupal ( | |
$hostname = $fqdn | |
){ | |
$loggingoffallow = { | |
log_not_found => "off", | |
access_log => "off", | |
allow => "all" | |
} | |
$denyall = { | |
deny => "all" | |
} | |
$return403 = { | |
return => "403" | |
} | |
nginx::resource::location { "favicon": | |
ensure => present, | |
location => "/favicon.ico", | |
vhost => $hostname, | |
location_custom_cfg => $loggingoffallow, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "robotstxt": | |
ensure => present, | |
location => "/robots.txt", | |
vhost => $hostname, | |
location_custom_cfg => $loggingoffallow, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "logstxt": | |
ensure => present, | |
location => '~* \.(txt|log)$', | |
vhost => $hostname, | |
location_custom_cfg => $denyall, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "phpprotect": | |
ensure => present, | |
location => '~ \..*/.*\.php$', | |
vhost => $hostname, | |
location_custom_cfg => $return403, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "private": | |
ensure => present, | |
location => '~ ^/sites/.*/private/', | |
vhost => $hostname, | |
location_custom_cfg => $return403, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "hidden": | |
ensure => present, | |
location => '~ (^|/)\.', | |
vhost => $hostname, | |
location_custom_cfg => $return403, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "htfiles": | |
ensure => present, | |
location => '~ /\.ht', | |
vhost => $hostname, | |
location_custom_cfg => $denyall, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "rewrite": | |
ensure => present, | |
location => "@rewrite", | |
vhost => $hostname, | |
location_custom_cfg => { | |
rewrite => "^ /index.php" | |
}, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "php": | |
ensure => present, | |
location => '~ \.php$', | |
vhost => $hostname, | |
fastcgi => "127.0.0.1:9000", | |
fastcgi_script => '$request_filename', | |
fastcgi_split_path => '^(.+\.php)(/.+)$', | |
location_cfg_append => { | |
fastcgi_intercept_errors => "on" | |
}, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "styles": | |
ensure => present, | |
location => '~ ^/sites/.*/files/styles/', | |
vhost => $hostname, | |
try_files => ['$uri', '@rewrite'], | |
www_root => $hbs::nginxvhost::docroot, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "assets": | |
ensure => present, | |
location => '~* \.(js|css|png|jpg|jpeg|gif|ico)$', | |
vhost => $hostname, | |
location_custom_cfg => { | |
expires => "max", | |
log_not_found => "off" | |
}, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
} |
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
class hbs::nginxnode ( | |
$hostname = $fqdn | |
){ | |
nginx::resource::upstream { 'hbsnode': | |
ensure => present, | |
members => [ | |
'localhost:4000' | |
], | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "api": | |
ensure => present, | |
location => "~ ^/api/", | |
proxy => "http://hbsnode", | |
vhost => $hostname, | |
location_cfg_append => { | |
rewrite => "^/api/(.+)?$ /$1 break;" | |
}, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
} |
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
class hbs::nginxsolr ( | |
$hostname = $fqdn | |
){ | |
nginx::resource::upstream { 'hbssolr': | |
ensure => present, | |
members => [ | |
'localhost:8080' | |
], | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
nginx::resource::location { "solr": | |
ensure => present, | |
location => "~ ^/solr/", | |
proxy => "http://hbssolr", | |
vhost => $hostname, | |
require => Nginx::Resource::Vhost[$hostname] | |
} | |
} |
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
class hbs::nginxvhost ( | |
$hostname = $fqdn, | |
$docroot = '/opt/development/clustermapping/cms/html' | |
){ | |
nginx::resource::vhost { $hostname: | |
ensure => present, | |
www_root => $docroot, | |
try_files => ['$uri', '@rewrite'] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment