Welcome to mirror list, hosted at ThFree Co, Russian Federation.

nginx.conf.erb « default « templates « diaspora « cookbooks « chef - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cc34eba51e394db1131dd556bfca6fdd3447a666 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#   Copyright (c) 2010, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

worker_processes 1;
daemon off;

events {
 worker_connections  8192;
}

http {

 include       mime.types;
 default_type  application/octet-stream;

 log_format splunky '$msec code=$status url=$uri bytes=$body_bytes_sent ms=$request_time';
 access_log /usr/local/nginx/logs/access.log splunky;

 sendfile on;

 keepalive_timeout  65;

 gzip              on;
 gzip_http_version 1.0;
 gzip_comp_level   2;
 gzip_proxied      any;
 gzip_buffers      16 8k;
 gzip_types        text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
 gzip_disable      "MSIE [1-6]\.(?!.*SV1)";


  upstream thin_cluster {
  <% @ports.each do |port| %>
    server <%="localhost:#{port}"%>;
  <% end %>
  }

  upstream resque_web {
    server localhost:5678;
  }

  server {
   listen       843;

   location / {
    rewrite ^(.*)$ /crossdomain.xml;
   }

   error_page 400  /crossdomain.xml;

   location = /crossdomain.xml {
    root html;
   }

  }

  server {
   listen  7894;
   server_name  <%= @url %>  www.<%= @url %>;

   auth_basic "Restricted";
   auth_basic_user_file  htpasswd;

   ssl on;
   ssl_certificate      /usr/local/nginx/conf/diaspora.crt;
   ssl_certificate_key  /usr/local/nginx/conf/diaspora.key;

   location / {
      proxy_set_header Host $http_host;
      proxy_pass http://resque_web;
   }
  }

  server {
   listen       80;
   server_name  <%= @url %>  www.<%= @url %>;
   rewrite      ^(.*) https://<%= @url %>$1 permanent;
  }

  server {

   listen       443;
   server_name  <%= @url %> www.<%= @url %>;
   root         /usr/local/app/diaspora/public;

   ssl on;
   ssl_certificate      <%= @cert_location %>;
   ssl_certificate_key  <%= @key_location %>;

   location /assets {
    expires 1d;
    add_header Cache-Control public;
   }

   location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    client_max_body_size 4M;
    client_body_buffer_size 128K;

    if (-f $request_filename/index.html) {
      rewrite (.*) $1/index.html break;
    }
    if (-f $request_filename.html) {
     rewrite (.*) $1.html break;
    }
    if (!-f $request_filename) {
     proxy_pass http://thin_cluster;
     break;
    }

    <% unless @s3_bucket.blank? || @s3_path.blank? %>
      <%= "rewrite ^/uploads/images/(.*)$ #{@s3_bucket}#{@s3_path}$1 permanent;" %>
    <% end %>
   }

   error_page 500 502 503 504 /50x.html;
   location = /50x.html {
    root html;
   }
}

}