自己架设了leanote后,通过admin对系统upload files and sizez做了设置但还是有上传大小限制,百度了N久之后发现问题可能出在了nginx设置上。
对我来说nginx就是两个作用,(1)当个WEB服务器用(2)给其它WEB应用走https
docker pull nginx
docker run -it -d --name mynginx --privileged --net=host nginx
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
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;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
server {
listen 443 ssl;
server_name 13ua.com;
ssl on;
ssl_certificate /usr/share/nginx/html/13
...
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_read_timeout 310s;
proxy_set_header Host $host;
...
改为
...
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_read_timeout 310s;
proxy_set_header Host $host:18443;
...
docker exec -i seafile nginx -s reload
vi /opt/seafile/seafile-server-latest/seahub/thirdpart/django/middleware/csrf.py
#转到220行
if request.method not in ('GET', 'HEAD', 'OPTIONS', 'TRACE'):
#改为
if request.method not in ('GET', 'POST', 'HEAD', 'OPTIONS', 'TRACE'):
vi /opt/seafile/seafile-server-latest/seahub/seahub/settings.py
#转到118行,注释掉这行
'django.middleware.csrf.CsrfViewMiddleware',
改为
#'django.middleware.csrf.CsrfViewMiddleware',
sed -i "220cif request.method not in ('GET', 'POST', 'HEAD', 'OPTIONS', 'TRACE'):" /opt/seafil