Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from ubilabs/feature/custom_nginx_sites

Override default nginx site template
  • Loading branch information...
commit f424008484905df544de591c2e1081b5c468d865 2 parents b68dc9d + f2aade7
@suchasurge suchasurge authored
Showing with 64 additions and 0 deletions.
  1. +64 −0 nginx/templates/default/site.erb
View
64 nginx/templates/default/site.erb
@@ -0,0 +1,64 @@
+server {
+ listen 80;
+ server_name <%= @application[:domains].join(" ") %> <%= node[:hostname] %>;
+ access_log <%= node[:nginx][:log_dir] %>/<%= @application[:domains].first %>.access.log;
+
+ <% if @application[:api_proxying_enabled] %>
+ location /api/ {
+ proxy_pass <%= @application[:api_proxy_url] %>;
+ }
+ <% end %>
+
+ location / {
+ root <%= @application[:absolute_document_root] %>;
+ index index.html index.htm index.php;
+ }
+
+ # Block all svn access
+ if ($request_uri ~* ^.*\.svn.*$) {
+ return 404;
+ }
+
+ # Block all git access
+ if ($request_uri ~* ^.*\.git.*$) {
+ return 404;
+ }
+
+ location /nginx_status {
+ stub_status on;
+ access_log off;
+ allow 127.0.0.1;
+ deny all;
+ }
+
+}
+
+<% if @application[:ssl_support] %>
+server {
+ listen 443;
+ server_name <%= @application[:domains].join(" ") %> <%= node[:hostname] %>;
+ access_log <%= node[:nginx][:log_dir] %>/<%= @application[:domains].first %>-ssl.access.log;
+
+ ssl on;
+ ssl_certificate /etc/nginx/ssl/<%= @application[:domains].first %>.crt;
+ ssl_certificate_key /etc/nginx/ssl/<%= @application[:domains].first %>.key;
+ <% if @application[:ssl_certificate_ca] -%>
+ ssl_client_certificate /etc/nginx/ssl/<%= @application[:domains].first %>.ca;
+ <% end -%>
+
+ location / {
+ root <%= @application[:absolute_document_root] %>;
+ index index.html index.htm index.php;
+ }
+
+ # Block all svn access
+ if ($request_uri ~* ^.*\.svn.*$) {
+ return 404;
+ }
+
+ # Block all git access
+ if ($request_uri ~* ^.*\.git.*$) {
+ return 404;
+ }
+}
+<% end %>
Please sign in to comment.
Something went wrong with that request. Please try again.