Skip to content

Instantly share code, notes, and snippets.

@balioune
Created May 3, 2020 14:36
Show Gist options
  • Save balioune/46e5cef1d40792a1d3ac2b040a9a3064 to your computer and use it in GitHub Desktop.
Save balioune/46e5cef1d40792a1d3ac2b040a9a3064 to your computer and use it in GitHub Desktop.
cat /etc/nginx/conf.d/school.conf
server {
listen *:80;
server_name *****;
access_log /var/log/nginx/access_school.log ;
error_log /var/log/nginx/error_school.log ;
client_body_buffer_size 8000M;
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 REMOTE_ADD $remote_addr;
location /media/ {
alias /usr/share/nginx/media/;
}
location /static/ {
alias /usr/share/nginx/static/; # your Django project's static files - amend as required
}
location / {
# uwsgi_pass unix:/opt/uwsgi/sock/school.sock;
include uwsgi_params; # the uwsgi_params file you installed
uwsgi_pass 127.0.0.1:3031;
}
location /fileupload {
# Pass altered request body to this location
# upload_pass @upload_backend;
upload_pass /school/upload;
upload_pass_args on;
# Store files to this directory
upload_store /var/www/images/;
# Allow uploaded files to be read only by user
upload_store_access user:rw group:rw all:rw;
set $upload_field_name "file";
# Set specified fields in request body
upload_set_form_field "${upload_field_name}_name" $upload_file_name;
upload_set_form_field "${upload_field_name}_content_type" $upload_content_type;
upload_set_form_field "${upload_field_name}_path" $upload_tmp_path;
# Inform backend about hash and size of a file
upload_aggregate_form_field "${upload_field_name}_md5" $upload_file_md5;
upload_aggregate_form_field "${upload_field_name}_size" $upload_file_size;
upload_pass_form_field "^.*$";
upload_limit_rate 0;
# upload_cleanup 400 404 499 500-505;
}
location @upload_backend {
# include uwsgi_params;
# proxy_pass http://127.0.0.0:3031/school/upload;
# uwsgi_pass unix:/opt/uwsgi/sock/school.sock;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment