Index: modules/web/templates/site.erb |
=================================================================== |
--- a/modules/web/templates/site.erb |
+++ b/modules/web/templates/site.erb |
@@ -1,35 +1,51 @@ |
server |
{ |
- listen 80 default_server; |
- listen [::]:80 default_server; |
+ <% if is_default %> |
+ listen 80 default_server; |
+ listen [::]:80 default_server; |
+ <% else %> |
+ listen 80; |
Felix Dahlke
2014/01/30 13:56:08
Ah, now I see where this came from for filterserve
|
+ listen [::]:80; |
+ <% end %> |
+ |
server_name '<%= vhost %>'; |
location / |
{ |
rewrite (.*) https://<%= vhost %>$1 permanent; |
} |
} |
server |
{ |
- listen 443 ssl default_server; |
- listen [::]:443 ssl default_server; |
+ <% if is_default %> |
+ listen 443 ssl default_server; |
+ listen [::]:443 ssl default_server; |
+ <% else %> |
+ listen 443 ssl; |
+ listen [::]:443 ssl; |
+ <% end %> |
+ |
+ server_name '<%= vhost %>'; |
+ |
ssl_certificate sites-available/adblockplus.org_sslcert.pem; |
ssl_certificate_key sites-available/adblockplus.org_sslcert.key; |
- server_name '<%= vhost %>'; |
- |
expires 1d; |
root /var/www/<%= vhost %>; |
index index; |
default_type text/html; |
+ <% if custom_config %> |
+ <%= custom_config %> |
+ <% end %> |
+ |
# Match Accept-Language header against available languages |
set $preferredLang ""; |
if ($http_accept_language ~ ^(\w\w)-(\w\w)\b) |
{ |
set $preferrredLang $1_$2; |
} |
if (!-f $document_root/$preferredLang/index) |
@@ -89,8 +105,30 @@ server |
location <%= location %> |
{ |
fastcgi_pass unix:/tmp/multiplexer-fastcgi.sock; |
include /etc/nginx/fastcgi_params; |
} |
<% end %> |
<% end %> |
} |
+ |
+<% if @aliases %> |
+ <% @aliases.each do |vhost_alias| %> |
+ server |
+ { |
+ listen 80; |
+ listen [::]:80; |
+ listen 443 ssl; |
+ listen [::]:443 ssl; |
+ |
+ server_name '<%= vhost_alias %>'; |
+ |
+ ssl_certificate sites-available/adblockplus.org_sslcert.pem; |
+ ssl_certificate_key sites-available/adblockplus.org_sslcert.key; |
+ |
+ location / |
+ { |
+ rewrite .* https://<%= vhost %>/ redirect; |
+ } |
+ } |
+ <% end %> |
+<% end %> |