Moved commen nginx configuration in a dedicated snippet
This commit is contained in:
parent
eef2ff3f9a
commit
1955005a4f
|
@ -0,0 +1,13 @@
|
||||||
|
# global proxy conf
|
||||||
|
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 $host:$server_port;
|
||||||
|
proxy_set_header X-Forwarded-Port $server_port;
|
||||||
|
proxy_redirect off;
|
||||||
|
|
||||||
|
# websocket support
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
|
@ -48,20 +48,6 @@ server {
|
||||||
|
|
||||||
root /srv/funkwhale/front/dist;
|
root /srv/funkwhale/front/dist;
|
||||||
|
|
||||||
# global proxy conf
|
|
||||||
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 $host:$server_port;
|
|
||||||
proxy_set_header X-Forwarded-Port $server_port;
|
|
||||||
proxy_redirect off;
|
|
||||||
|
|
||||||
# websocket support
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection $connection_upgrade;
|
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ @rewrites;
|
try_files $uri $uri/ @rewrites;
|
||||||
}
|
}
|
||||||
|
@ -70,6 +56,7 @@ server {
|
||||||
rewrite ^(.+)$ /index.html last;
|
rewrite ^(.+)$ /index.html last;
|
||||||
}
|
}
|
||||||
location /api/ {
|
location /api/ {
|
||||||
|
include /etc/nginx/funkwhale_proxy.conf;
|
||||||
# this is needed if you have file import via upload enabled
|
# this is needed if you have file import via upload enabled
|
||||||
client_max_body_size 30M;
|
client_max_body_size 30M;
|
||||||
proxy_pass http://funkwhale-api/api/;
|
proxy_pass http://funkwhale-api/api/;
|
||||||
|
@ -89,6 +76,7 @@ server {
|
||||||
|
|
||||||
# Transcoding logic and caching
|
# Transcoding logic and caching
|
||||||
location = /transcode-auth {
|
location = /transcode-auth {
|
||||||
|
include /etc/nginx/funkwhale_proxy.conf;
|
||||||
# needed so we can authenticate transcode requests, but still
|
# needed so we can authenticate transcode requests, but still
|
||||||
# cache the result
|
# cache the result
|
||||||
internal;
|
internal;
|
||||||
|
@ -97,14 +85,13 @@ server {
|
||||||
if ($request_uri ~* "[^\?]+\?(.*)$") {
|
if ($request_uri ~* "[^\?]+\?(.*)$") {
|
||||||
set $query $1;
|
set $query $1;
|
||||||
}
|
}
|
||||||
proxy_set_header X-Forwarded-Host $host:$server_port;
|
|
||||||
proxy_set_header X-Forwarded-Port $server_port;
|
|
||||||
proxy_pass http://funkwhale-api/api/v1/trackfiles/viewable/?$query;
|
proxy_pass http://funkwhale-api/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 "";
|
||||||
}
|
}
|
||||||
|
|
||||||
location /api/v1/trackfiles/transcode/ {
|
location /api/v1/trackfiles/transcode/ {
|
||||||
|
include /etc/nginx/funkwhale_proxy.conf;
|
||||||
# this block deals with authenticating and caching transcoding
|
# this block deals with authenticating and caching transcoding
|
||||||
# requests. Caching is heavily recommended as transcoding
|
# requests. Caching is heavily recommended as transcoding
|
||||||
# is a CPU intensive process.
|
# is a CPU intensive process.
|
||||||
|
|
|
@ -59,10 +59,11 @@ Ensure you have a recent version of nginx on your server. On debian-like system,
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install nginx
|
apt-get install nginx
|
||||||
|
|
||||||
Then, download our sample virtualhost file:
|
Then, download our sample virtualhost file and proxy conf:
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
|
curl -L -o /etc/nginx/funkwhale_proxy.conf "https://code.eliotberriot.com/funkwhale/funkwhale/raw/|version|/deploy/funkwhale_proxy.conf"
|
||||||
curl -L -o /etc/nginx/sites-enabled/funkwhale.conf "https://code.eliotberriot.com/funkwhale/funkwhale/raw/|version|/deploy/nginx.conf"
|
curl -L -o /etc/nginx/sites-enabled/funkwhale.conf "https://code.eliotberriot.com/funkwhale/funkwhale/raw/|version|/deploy/nginx.conf"
|
||||||
|
|
||||||
Ensure static assets and proxy pass match your configuration, and check the configuration is valid with ``nginx -t``. If everything is fine, you can restart your nginx server with ``service nginx restart``.
|
Ensure static assets and proxy pass match your configuration, and check the configuration is valid with ``nginx -t``. If everything is fine, you can restart your nginx server with ``service nginx restart``.
|
||||||
|
|
Loading…
Reference in New Issue