debian multitenant: rewrite nginx-example and put it to the right place

This commit is contained in:
Jérôme Schneider 2015-05-11 16:23:26 +02:00
parent 505a7a3fc8
commit 4f7982c873
3 changed files with 12 additions and 12 deletions

View File

@ -1,3 +1,4 @@
AUTHORS.txt
COPYING
README
debian/multitenant/nginx-example.conf

View File

@ -1,4 +1,3 @@
debian/multitenant/nginx-example.conf /etc/authentic2-multitenant
debian/multitenant/authentic2-multitenant-manage /usr/bin
debian/multitenant/config.py /etc/authentic2-multitenant
debian/multitenant/debian_config.py /usr/lib/authentic2-multitenant

View File

@ -9,9 +9,15 @@ server {
access_log /var/log/nginx/authentic.example.fr-access.log combined;
error_log /var/log/nginx/authentic.example.fr-error.log;
location ~ /static(.*)$ {
location ~ /static/(.+)$ {
root /;
try_files /var/lib/authentic2-multitenant/static$1 /var/lib/authentic2-multitenant/collected-static$1 =404;
try_files /var/lib/authentic2-multitenant/tenants/$host/static/$1
/var/lib/authentic2-multitenant/collectstatic/$1
=404;
}
location ~ ^/media/(.+)$ {
alias /var/lib/authentic2-multitenant/tenants/$host/media/$1;
}
location / {
@ -20,6 +26,8 @@ server {
proxy_set_header X-Forwarded-SSL on;
proxy_set_header X-Forwarded-Protocol ssl;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
@ -30,14 +38,6 @@ server {
access_log /var/log/nginx/authentic.example.fr-access.log combined;
error_log /var/log/nginx/authentic.example.fr-error.log;
location ~ /static(.*)$ {
root /;
try_files /var/lib/authentic2-multitenant/static$1 /var/lib/authentic2-multitenant/collected-static$1 =404;
}
location / {
proxy_pass http://unix:/var/run/authentic2-multitenant/authentic2-multitenant.sock;
proxy_set_header Host $http_host;
}
return 302 $host$request_uri;
}