-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use proxy to put everything behind the same address
- Loading branch information
Showing
4 changed files
with
129 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
FROM nginx:1.23 | ||
|
||
COPY default.conf.template /etc/nginx/templates/default.conf.template | ||
ARG TEMPLATE_NAME=default | ||
|
||
COPY ${TEMPLATE_NAME}.conf.template /etc/nginx/templates/default.conf.template | ||
RUN mkdir /statics /media_files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
map $http_upgrade $connection_upgrade { | ||
default upgrade; | ||
'' close; | ||
} | ||
|
||
upstream django { | ||
server django:8000; | ||
keepalive 64; | ||
} | ||
|
||
upstream maps { | ||
server maps:80; | ||
keepalive 64; | ||
} | ||
|
||
upstream titiler { | ||
server titiler:8000; | ||
keepalive 64; | ||
} | ||
|
||
|
||
server { | ||
listen 80; | ||
resolver 127.0.0.11; | ||
|
||
#access_log /var/log/nginx/host.access.log main; | ||
|
||
#error_page 404 /404.html; | ||
|
||
# redirect server error pages to the static page /50x.html | ||
# | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
client_max_body_size 300m; | ||
|
||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_set_header X-NginX-Proxy true; | ||
proxy_set_header Cookie $http_cookie; | ||
proxy_redirect off; | ||
|
||
location /static/ { | ||
alias /statics/; | ||
try_files $uri @proxy; | ||
} | ||
|
||
location /media/ { | ||
alias /media_files/; | ||
add_header 'Access-Control-Allow-Origin' '*'; | ||
} | ||
|
||
location /geoapi/static/ { | ||
alias /statics/geoapi/; | ||
try_files $uri @proxy; | ||
} | ||
|
||
location @proxy { | ||
proxy_pass http://django; | ||
proxy_http_version 1.1; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection $connection_upgrade; | ||
} | ||
|
||
location /titiler/ { | ||
proxy_pass http://titiler; | ||
proxy_http_version 1.1; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection $connection_upgrade; | ||
} | ||
|
||
location /admin/ { | ||
# TODO: use a better solution to upload files, for example s3 + tusd | ||
# allow upload of big file - this is a temporary solution | ||
client_max_body_size 8000M; | ||
client_body_buffer_size 8000M; | ||
client_body_timeout 360; | ||
|
||
proxy_pass http://django; | ||
proxy_http_version 1.1; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection $connection_upgrade; | ||
} | ||
|
||
location /api/ { | ||
# TODO: use a better solution to upload files, for example s3 + tusd | ||
# allow upload of big file - this is a temporary solution | ||
client_max_body_size 8000M; | ||
client_body_buffer_size 8000M; | ||
client_body_timeout 360; | ||
|
||
proxy_pass http://django; | ||
proxy_http_version 1.1; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection $connection_upgrade; | ||
} | ||
|
||
location / { | ||
proxy_pass http://maps; | ||
proxy_http_version 1.1; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection $connection_upgrade; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters