[DRE-commits] [diaspora] 166/257: iadd nginx configuration
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Sun Apr 12 14:17:21 UTC 2015
This is an automated email from the git hooks/post-receive script.
praveen pushed a commit to branch master
in repository diaspora.
commit de2db6f7bb84e039ebb7d79db2dd7eba630cde4f
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Fri Nov 28 16:01:03 2014 +0530
iadd nginx configuration
---
debian/config | 5 ++-
debian/docs | 1 +
debian/nginx.conf.example | 80 +++++++++++++++++++++++++++++++++++++++++++++++
debian/postinst | 1 +
4 files changed, 86 insertions(+), 1 deletion(-)
diff --git a/debian/config b/debian/config
index 5feb301..52b716f 100644
--- a/debian/config
+++ b/debian/config
@@ -23,7 +23,10 @@ db_go
# Configure pod address.
db_get diaspora/url
if ! grep ENVIRONMENT_URL /etc/diaspora.conf >/dev/null
- then echo export ENVIRONMENT_URL=http://$RET >> /etc/diaspora.conf
+ then
+ echo export SERVERNAME=$RET >> /etc/diaspora.conf
+ sed -e "s/SERVERNAME_FIXME/$RET/" -e "s/DIASPORA_SSL_PATH_FIXME/\\/etc\\/diaspora/" -e "s/DIASPORA_ROOT_FIXME/\\/usr\\/share\\/diaspora/" /usr/share/doc/diaspora/nginx.conf.example
+ ln -s /etc/nginx/sites-available/$RET /etc/nginx/sites-enabled/
fi
if [ "$RET" = "false" ]; then
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..a4d5592
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+debian/niginx.conf.example
diff --git a/debian/nginx.conf.example b/debian/nginx.conf.example
new file mode 100644
index 0000000..a4f60dc
--- /dev/null
+++ b/debian/nginx.conf.example
@@ -0,0 +1,80 @@
+upstream domain1 {
+ 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_PATH_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://domain1;
+
+ 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;
+ }
+}
+
diff --git a/debian/postinst b/debian/postinst
index f688fa0..ba7eea1 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -76,6 +76,7 @@ case "$1" in
# source diaspora variables
. /etc/diaspora.conf
+ export ENVIRONMENT_URL=http://${SERVERNAME}
echo "Verifying we have all required libraries..."
sudo -u diaspora -E bundle install --local
echo "Initializing database..."
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/diaspora.git
More information about the Pkg-ruby-extras-commits
mailing list