121 lines
2.4 KiB
Text
121 lines
2.4 KiB
Text
# 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 / {
|
|
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;
|
|
}
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root html;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|