1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00
mxpv-podsync/cmd/nginx/podsync.conf
2019-07-10 19:50:20 -07:00

96 lines
2.4 KiB
Plaintext

user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events { worker_connections 1024; }
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
gzip on;
gzip_types text/plain application/json text/css application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
gzip_min_length 1000;
gzip_proxied any;
upstream api {
server api:5001;
}
upstream resolver {
server resolver:5002;
}
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
server {
server_name _;
listen 80;
root /var/www/podsync/;
index index.html;
# Cache media: images, icons, video, audio, HTC
# See https://serversforhackers.com/c/nginx-caching
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|ogg|ogv|webm|htc)$ {
expires 3M;
access_log off;
add_header Cache-Control "public";
}
# Cache CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
# Cache fonts
location ~* \.(?:ttf|woff|woff2|eot|otf)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
location /nginx-ping {
access_log off;
return 200 "pong\n";
}
location /download {
proxy_read_timeout 180s;
proxy_pass http://resolver;
}
location = /api/webhooks {
proxy_pass http://api;
client_max_body_size 128k;
}
location ~ (/user|/api) {
proxy_pass http://api;
}
location ~* \.(?:html)$ {
try_files $uri /index.html;
}
location / {
try_files $uri $uri.html $uri/ @api;
}
location @api {
proxy_pass http://api;
proxy_buffers 8 16k;
proxy_buffer_size 16k;
}
}
}