Serve it all with nginx.

This commit is contained in:
Ralph Bean 2015-06-16 17:15:24 +00:00
parent 8a23a413cc
commit 5108aa0351
2 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,46 @@
server {
listen 80 default_server;
server_name _;
large_client_header_buffers 4 32k;
client_max_body_size 50M;
charset utf-8;
# Frontend
location / {
root /home/taiga/taiga-front-dist/dist/;
try_files $uri $uri/ /index.html;
}
# Backend
location /api {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8001/api;
proxy_redirect off;
}
# Django admin access (/admin/)
location /admin {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8001$request_uri;
proxy_redirect off;
}
# Static files
location /static {
alias /home/taiga/taiga-back/static;
}
# Media files
location /media {
alias /home/taiga/taiga-back/media;
}
}

View file

@ -166,3 +166,20 @@
state=link
tags: taiga
### DONE with taiga-front
### FINALLY, nginx to serve/proxy it all
- copy: src=taiga.nginx dest=/etc/nginx/sites-available/taiga
mode=0644 owner=nginx group=nginx
notify: restart nginx
tags: taiga
- file: dest=/etc/nginx/site-enabled/default state=absent
notify: restart nginx
tags: taiga
- file: src=/etc/nginx/sites-available/taiga dest=/etc/nginx/site-enabled/taiga state=link
notify: restart nginx
tags: taiga
- service: name=nginx state=running enabled=yes
tags: taiga