Fully working with custom nginx conf behind an existing reverse proxy

master
Meliurwen 4 years ago
commit ed662df834
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 24
      .env.example
  2. 1
      .gitignore
  3. 50
      docker-compose.yml
  4. 11
      seafile.env.example
  5. 60
      seafile.nginx.conf.template

@ -0,0 +1,24 @@
# Global Settings
LOCAL_STACK_DIR=/srv/docker/volumes/seafile
# Networks
NETWORK=
# Seafile
SF_IMG=
SF_TAG=
SF_CONTAINER_NAME=
SF_RESTART=
# Database
DB_IMG=
DB_TAG=
DB_CONTAINER_NAME=
DB_RESTART=
DB_ROOT_PASSWD=
# Memcached
MC_IMG=
MC_TAG=
MC_CONTAINER_NAME=
MC_RESTART=

1
.gitignore vendored

@ -0,0 +1 @@
*.env

@ -0,0 +1,50 @@
version: '3'
services:
db:
image: ${DB_IMG:-mariadb}:${DB_TAG:-latest}
container_name: ${DB_CONTAINER_NAME:-seafile-db}
restart: ${DB_RESTART:-unless-stopped}
environment:
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWD:-changemeplease}
- MYSQL_LOG_CONSOLE=true
volumes:
- ${LOCAL_STACK_DIR}/db:/var/lib/mysql
networks:
- seafile-net
memcached:
image: ${MC_IMG:-memcached}:${MC_TAG:-alpine}
container_name: ${MC_CONTAINER_NAME:-seafile-memcached}
restart: ${MC_RESTART:-unless-stopped}
entrypoint: memcached -m 256
networks:
- seafile-net
seafile:
image: ${SF_IMG:-seafileltd/seafile-mc}:${SF_TAG:-latest}
container_name: ${SF_CONTAINER_NAME:-seafile}
restart: ${SF_RESTART:-unless-stopped}
expose:
- "80"
volumes:
- ${LOCAL_STACK_DIR}/seafile/data:/shared
- ./seafile.nginx.conf.template:/templates/seafile.nginx.conf.template:ro
environment:
- DB_HOST=db
- DB_ROOT_PASSWD=${DB_ROOT_PASSWD:-changemeplease}
env_file:
- seafile.env
depends_on:
- db
- memcached
networks:
- default
- seafile-net
networks:
default:
external:
name: ${NETWORK:-webservices}
seafile-net:
internal: true

@ -0,0 +1,11 @@
TIME_ZONE=Etc/UTC
SEAFILE_ADMIN_EMAIL=me@example.com
SEAFILE_ADMIN_PASSWORD=asecret
SEAFILE_SERVER_LETSENCRYPT=false
#SEAFILE_SERVER_HOSTNAME=docs.seafile.com
# Reverse-proxy and certbot
VIRTUAL_HOST=domain.tld
VIRTUAL_PORT=80
LETSENCRYPT_HOST=domain.tld
LETSENCRYPT_EMAIL=user@domain.tld

@ -0,0 +1,60 @@
# -*- mode: nginx -*-
# Auto generated at {{ current_timestr }}
server {
listen 80;
server_name {{ domain }};
client_max_body_size 10m;
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_read_timeout 310s;
proxy_set_header Host $host;
proxy_set_header Forwarded "for=$proxy_add_x_forwarded_for;proto=$http_x_forwarded_proto";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Real-IP $proxy_add_x_forwarded_for;
proxy_set_header Connection "";
proxy_http_version 1.1;
client_max_body_size 0;
access_log /var/log/nginx/seahub.access.log seafileformat;
error_log /var/log/nginx/seahub.error.log;
}
location /seafhttp {
rewrite ^/seafhttp(.*)$ $1 break;
proxy_pass http://127.0.0.1:8082;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 0;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
proxy_request_buffering off;
access_log /var/log/nginx/seafhttp.access.log seafileformat;
error_log /var/log/nginx/seafhttp.error.log;
}
location /seafdav {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_read_timeout 1200s;
client_max_body_size 0;
access_log /var/log/nginx/seafdav.access.log seafileformat;
error_log /var/log/nginx/seafdav.error.log;
}
location /media {
root /opt/seafile/seafile-server-latest/seahub;
}
# For letsencrypt
location /.well-known/acme-challenge/ {
alias /var/www/challenges/;
try_files $uri =404;
}
}
Loading…
Cancel
Save