diff --git a/.drone.yml b/.drone.yml index 43a453f..5780678 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,7 +2,7 @@ pipeline: nginx-conf: image: nginx:mainline commands: - - cp nginx.conf /etc/nginx/ + - cp -r nginx /etc/nginx - nginx -t docker: image: plugins/docker diff --git a/Dockerfile b/Dockerfile index 8b1f63a..2bf2662 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN apt update && apt install locales -y && apt install -y --no-install-recommen COPY conf /opt/seafile/conf COPY conf /etc/seafile -COPY nginx.conf /etc/nginx/nginx.conf +COPY nginx /etc/nginx COPY scripts/upgrade.py /usr/local/sbin/upgrade COPY scripts/seafile-server.sh /sbin/seafile-server diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index 9a199e9..0000000 --- a/nginx.conf +++ /dev/null @@ -1,83 +0,0 @@ -events { - worker_connections 64; -} - -http{ - - upstream hub { - server 127.0.0.1:8000; - keepalive 2; - } - - upstream files { - server 127.0.0.1:8082; - keepalive 4; - } - - upstream webdav { - server 127.0.0.1:8080; - keepalive 2; - } - - disable_symlinks off; - - server { - listen 80; - - error_log /dev/stderr; - access_log syslog:server=unix:/dev/log; - - - - - proxy_set_header X-Forwarded-For $remote_addr; - - location / { - proxy_pass http://hub; - 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-Host $server_name; - proxy_read_timeout 1200s; - - # used for view/edit office file via Office Online Server - client_max_body_size 0; - - } - - location /seafhttp { - rewrite ^/seafhttp(.*)$ $1 break; - proxy_pass http://files; - proxy_http_version 1.1; - client_max_body_size 0; - proxy_connect_timeout 3s; - proxy_read_timeout 3600s; - proxy_send_timeout 3600s; - send_timeout 3600s; - } - - location /seafdav { - fastcgi_pass webdav; - fastcgi_keep_conn on; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_script_name; - - fastcgi_param SERVER_PROTOCOL $server_protocol; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param REQUEST_METHOD $request_method; - fastcgi_param CONTENT_TYPE $content_type; - fastcgi_param CONTENT_LENGTH $content_length; - fastcgi_param SERVER_ADDR $server_addr; - fastcgi_param SERVER_PORT $server_port; - fastcgi_param SERVER_NAME $server_name; - - client_max_body_size 0; - - } - - location /media { - root /opt/seafile/seafile-server-latest/seahub; - } - } - -} diff --git a/nginx/backends.conf b/nginx/backends.conf new file mode 100644 index 0000000..f3f2d41 --- /dev/null +++ b/nginx/backends.conf @@ -0,0 +1,14 @@ +upstream hub { + server 127.0.0.1:8000; + keepalive 2; +} + +upstream files { + server 127.0.0.1:8082; + keepalive 4; +} + +upstream webdav { + server 127.0.0.1:8080; + keepalive 2; +} diff --git a/nginx/extra.conf b/nginx/extra.conf new file mode 100644 index 0000000..e69de29 diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..01e9a40 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,22 @@ +events { + worker_connections 64; +} + +http { + + include backends.conf; + + disable_symlinks off; + + server { + + listen 80; + + error_log /dev/stderr; + + include seafile/*.conf; + + include extra.conf; + } + +} diff --git a/nginx/seafile/media.conf b/nginx/seafile/media.conf new file mode 100644 index 0000000..6548f00 --- /dev/null +++ b/nginx/seafile/media.conf @@ -0,0 +1,3 @@ +location /media { + root /opt/seafile/seafile-server-latest/seahub; +} diff --git a/nginx/seafile/seafdav.conf b/nginx/seafile/seafdav.conf new file mode 100644 index 0000000..92bdf4a --- /dev/null +++ b/nginx/seafile/seafdav.conf @@ -0,0 +1,18 @@ +location /seafdav { + fastcgi_pass webdav; + fastcgi_keep_conn on; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_script_name; + + fastcgi_param SERVER_PROTOCOL $server_protocol; + fastcgi_param QUERY_STRING $query_string; + fastcgi_param REQUEST_METHOD $request_method; + fastcgi_param CONTENT_TYPE $content_type; + fastcgi_param CONTENT_LENGTH $content_length; + fastcgi_param SERVER_ADDR $server_addr; + fastcgi_param SERVER_PORT $server_port; + fastcgi_param SERVER_NAME $server_name; + + client_max_body_size 0; + +} diff --git a/nginx/seafile/seafhttp.conf b/nginx/seafile/seafhttp.conf new file mode 100644 index 0000000..424bd1a --- /dev/null +++ b/nginx/seafile/seafhttp.conf @@ -0,0 +1,10 @@ +location /seafhttp { + rewrite ^/seafhttp(.*)$ $1 break; + proxy_pass http://files; + proxy_http_version 1.1; + client_max_body_size 0; + proxy_connect_timeout 3s; + proxy_read_timeout 3600s; + proxy_send_timeout 3600s; + send_timeout 3600s; +} diff --git a/nginx/seafile/seahub.conf b/nginx/seafile/seahub.conf new file mode 100644 index 0000000..106ed09 --- /dev/null +++ b/nginx/seafile/seahub.conf @@ -0,0 +1,14 @@ +location / { + proxy_pass http://hub; + 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-Host $server_name; + proxy_read_timeout 1200s; + + # used for view/edit office file via Office Online Server + client_max_body_size 0; + + access_log /dev/stdout; + +}