[DRE-commits] [diaspora-installer] 07/55: add nginx configuration

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Mon Dec 8 12:41:22 UTC 2014


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository diaspora-installer.

commit bb8150daf6070cf9d01558be2b574441e994b9d3
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Tue Dec 2 17:46:28 2014 +0530

    add nginx configuration
---
 debian/config                  | 36 +++++++++++++++++++
 debian/diaspora-installer.docs |  1 +
 debian/nginx.conf.example      | 80 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 117 insertions(+)

diff --git a/debian/config b/debian/config
new file mode 100644
index 0000000..b5d4bc6
--- /dev/null
+++ b/debian/config
@@ -0,0 +1,36 @@
+#!/bin/sh
+# config maintainer script for diaspora-installer
+ 
+set -e
+
+# source debconf stuff
+. /usr/share/debconf/confmodule
+
+# source dbconfig-common shell library, and call the hook function
+if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then
+   . /usr/share/dbconfig-common/dpkg/config.pgsql
+
+   dbc_dbname="diaspora_pristine_production"
+   dbc_dbuser="diasporapristine"
+
+   dbc_go diaspora-installer $@
+fi
+
+# What is your pod address?
+db_input high diaspora-installer/url || true
+db_go
+
+# Configure pod address.
+db_get diaspora-installer/url
+if ! test -f /etc/diaspora-pristine.conf
+	then 
+		echo export SERVERNAME=$RET >> /etc/diaspora-pristine.conf
+		echo export ENVIRONMENT_URL=https://$SERVERNAME >> /etc/diaspora-pristine.conf
+		sed -e "s/SERVERNAME_FIXME/$RET/" -e "s/DIASPORA_SSL_PATH_FIXME/\\/etc\\/diaspora-pristine/" -e "s/DIASPORA_ROOT_FIXME/\\/usr\\/share\\/diaspora-pristine/" /usr/share/doc/diaspora-installer/nginx.conf.example >/etc/nginx/sites-available/pristine-$RET
+		ln -fs /etc/nginx/sites-available/pristine-$RET /etc/nginx/sites-enabled/
+fi
+
+if [ "$RET" = "false" ]; then
+    db_go
+fi
+
diff --git a/debian/diaspora-installer.docs b/debian/diaspora-installer.docs
new file mode 100644
index 0000000..fee0fb2
--- /dev/null
+++ b/debian/diaspora-installer.docs
@@ -0,0 +1 @@
+debian/nginx.conf.example
diff --git a/debian/nginx.conf.example b/debian/nginx.conf.example
new file mode 100644
index 0000000..400fbc9
--- /dev/null
+++ b/debian/nginx.conf.example
@@ -0,0 +1,80 @@
+upstream domain11 {
+        server 127.0.0.1:3000;
+}
+
+server {
+	listen		80;
+	server_name	SERVERNAME_FIXME;
+	rewrite		^ https://$server_name$request_uri? permanent;
+}
+
+server {
+            listen   	443;
+            server_name SERVERNAME_FIXME;
+
+            proxy_set_header   X-Real-IP  $remote_addr;
+            proxy_set_header   X-FORWARDED-PROTO https;
+
+	    ssl on;
+	    ssl_certificate     DIASPORA_SSL_PATH_FIXME/ssl/SERVERNAME_FIXME-bundle.pem;
+	    ssl_certificate_key DIASPORA_SSL_PATH_FIXME/ssl/SERVERNAME_FIXME.key;
+
+            access_log /var/log/diaspora/access.log;
+            error_log /var/log/diaspora/error.log;
+
+            root   DIASPORA_ROOT_FIXME/public/;
+            index  index2.html;
+
+            if ($http_user_agent ~* Googlebot) {
+                return 403;
+            }
+
+  	    location /uploads/images {
+	      expires 1d;
+	      add_header Cache-Control public;
+	    }
+
+            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_set_header X-Forwarded-Proto https;
+                          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://domain11;
+
+                                           break;
+                          }
+            }
+
+	if ($http_user_agent ~ "Python-urllib" ) {
+		return 403;
+	}
+
+	if ($http_user_agent ~ "libwww-perl" ) {
+		return 403;
+	}
+
+	error_page 500 502 503 504  /50x.html;
+	location = /50x.html {
+		root  DIASPORA_ROOT_FIXME;
+	}
+}
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/diaspora-installer.git



More information about the Pkg-ruby-extras-commits mailing list