Verified Commit 7205a8b2 authored by Agate's avatar Agate 💬

Development nginx container now work with customized port

parent 96d219df
...@@ -3,8 +3,8 @@ proxy_set_header Host $host; ...@@ -3,8 +3,8 @@ proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host:$server_port; proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Port $server_port; proxy_set_header X-Forwarded-Port $server_port;
proxy_redirect off; proxy_redirect off;
# websocket support # websocket support
......
...@@ -72,15 +72,20 @@ services: ...@@ -72,15 +72,20 @@ services:
- redis - redis
nginx: nginx:
command: /entrypoint.sh
env_file: env_file:
- .env.dev - .env.dev
- .env - .env
image: nginx image: nginx
environment:
- "WEBPACK_DEVSERVER_PORT=${WEBPACK_DEVSERVER_PORT-8080}"
links: links:
- api - api
- front - front
volumes: volumes:
- ./docker/nginx/conf.dev:/etc/nginx/nginx.conf - ./docker/nginx/conf.dev:/etc/nginx/nginx.conf
- ./docker/nginx/entrypoint.sh:/entrypoint.sh:ro
- ./deploy/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf.template:ro
- ./api/funkwhale_api/media:/protected/media - ./api/funkwhale_api/media:/protected/media
ports: ports:
- "0.0.0.0:6001:6001" - "0.0.0.0:6001:6001"
......
...@@ -37,19 +37,7 @@ http { ...@@ -37,19 +37,7 @@ http {
listen 6001; listen 6001;
charset utf-8; charset utf-8;
client_max_body_size 20M; client_max_body_size 20M;
include /etc/nginx/funkwhale_proxy.conf;
# global proxy pass config
proxy_set_header Host $host;
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-Forwarded-Host localhost:8080;
proxy_set_header X-Forwarded-Port 8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;
location /_protected/media { location /_protected/media {
internal; internal;
alias /protected/media; alias /protected/media;
...@@ -63,8 +51,7 @@ http { ...@@ -63,8 +51,7 @@ http {
if ($request_uri ~* "[^\?]+\?(.*)$") { if ($request_uri ~* "[^\?]+\?(.*)$") {
set $query $1; set $query $1;
} }
proxy_set_header X-Forwarded-Host localhost:8080; include /etc/nginx/funkwhale_proxy.conf;
proxy_set_header X-Forwarded-Port 8080;
proxy_pass http://api:12081/api/v1/trackfiles/viewable/?$query; proxy_pass http://api:12081/api/v1/trackfiles/viewable/?$query;
proxy_pass_request_body off; proxy_pass_request_body off;
proxy_set_header Content-Length ""; proxy_set_header Content-Length "";
...@@ -78,6 +65,7 @@ http { ...@@ -78,6 +65,7 @@ http {
if ($args ~ (.*)jwt=[^&]*(.*)) { if ($args ~ (.*)jwt=[^&]*(.*)) {
set $cleaned_args $1$2; set $cleaned_args $1$2;
} }
include /etc/nginx/funkwhale_proxy.conf;
proxy_cache_key "$scheme$request_method$host$uri$is_args$cleaned_args"; proxy_cache_key "$scheme$request_method$host$uri$is_args$cleaned_args";
proxy_cache transcode; proxy_cache transcode;
proxy_cache_valid 200 7d; proxy_cache_valid 200 7d;
...@@ -87,6 +75,7 @@ http { ...@@ -87,6 +75,7 @@ http {
proxy_pass http://api:12081; proxy_pass http://api:12081;
} }
location / { location / {
include /etc/nginx/funkwhale_proxy.conf;
proxy_pass http://api:12081/; proxy_pass http://api:12081/;
} }
} }
......
#!/bin/bash -eux
echo "Copying template file..."
cp /etc/nginx/funkwhale_proxy.conf{.template,}
sed -i "s/X-Forwarded-Host \$host:\$server_port/X-Forwarded-Host localhost:${WEBPACK_DEVSERVER_PORT}/" /etc/nginx/funkwhale_proxy.conf
sed -i "s/proxy_set_header X-Forwarded-Port \$server_port/proxy_set_header X-Forwarded-Port ${WEBPACK_DEVSERVER_PORT}/" /etc/nginx/funkwhale_proxy.conf
cat /etc/nginx/funkwhale_proxy.conf
nginx -g "daemon off;"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment