Created
January 7, 2017 17:32
-
-
Save amalleo25/cf3fced033ea6f5e5ae029abeaa051b9 to your computer and use it in GitHub Desktop.
Nginx config for seafile server running on a different host
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 80; | |
| server_name seafile.example.com; | |
| rewrite ^ https://$http_host$request_uri? permanent; # force redirect http to https | |
| } | |
| server { | |
| listen 443 ssl; | |
| server_name seafile.example.com; | |
| ssl_certificate /etc/ssl/certs/seafile.example.com.crt; | |
| ssl_certificate_key /etc/ssl/private/seafile.example.com.key; | |
| # Extra SSL settings. Not required | |
| ssl_protocols TLSv1.2; | |
| ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4:!3DES:!SHA; | |
| ssl_prefer_server_ciphers on; | |
| ssl_session_cache shared:SSL:1m; | |
| proxy_set_header X-Forwarded-For $remote_addr; | |
| add_header Strict-Transport-Security "max-age=31536000; includeSubDomains"; | |
| server_tokens off; | |
| access_log /var/log/nginx/seafile.access.log; | |
| error_log /var/log/nginx/seafile.error.log debug; | |
| rewrite_log on; | |
| #Seafile proxy must be before seahub proxy in order for download/upload to work | |
| location ~ /seafhttp { | |
| rewrite ^/seafhttp(.*)$ $1 break; | |
| proxy_pass http://seafile:8082; | |
| client_max_body_size 0; | |
| proxy_connect_timeout 36000s; | |
| proxy_read_timeout 36000s; | |
| proxy_send_timeout 36000s; | |
| send_timeout 36000s; | |
| access_log /var/log/nginx/seafhttp.access.log; | |
| error_log /var/log/nginx/seafhttp.error.log; | |
| rewrite_log on; | |
| } | |
| location ~ / { | |
| fastcgi_pass seafile:8000; | |
| 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; | |
| fastcgi_param REMOTE_ADDR $remote_addr; | |
| fastcgi_param HTTPS on; | |
| fastcgi_param HTTP_SCHEME https; | |
| fastcgi_read_timeout 36000; | |
| access_log /var/log/nginx/seahub.access.log; | |
| error_log /var/log/nginx/seahub.error.log; | |
| rewrite_log on; | |
| } | |
| location ~ /media { | |
| root /home/seafile/seafile-server-latest/seahub; | |
| access_log /var/log/nginx/media.access.log; | |
| error_log /var/log/nginx/media.error.log; | |
| rewrite_log on; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment