I have a problem with nginx that doesn't receive form-data.
Now I'm preparing web application using nginx and aws ec2.
Currently, ubuntu+django+uwsgi+nginx is placed on ec2 through ssh.
The problem is, on my computer, all the features on the ec2 Public Instances page are normally worked, but if another computer(different IP)enter the page(page opens well) and try to send formData to a server(nginx) then error403(incomplete chunked encoding) occurs.
It has also set up 80 ports in the security group of the ec2.
How can I receive a video file(formData) sent by an external user from a browser?
What I've done so far
1.setting client_max_body_size client_max_body_size 50M;
2.change chown-socket value 660 => 666
3.change load balance round robin => hash
4.changed the user of nginx.conf to www-data
//uwsgi.ini
[uwsgi]
uid=django
base=/var/www/fileconvert
home=%(base)/venv
chdir=%(base)
module=config.wsgi:application
env=DJANGO_SETTINGS_MODULE=config.settings
master=true
processes=5
socket=%(base)/run/uwsgi.sock
logto=%(base)/logs/uwsgi.log
chown-socket=%(uid):www-data
chmod-socket=666
vacuum=true
//uwsgi.service
[Unit]
Description=uWSGI Emperor service
[Service]
ExecStart=/var/www/fileconvert/venv/bin/uwsgi --emperor /var/www/fileconvert/run
User=django
Group=www-data
Restart=on-failure
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all
StandardError=syslog
[Install]
WantedBy=multi-user.target
// sites-available/fileconvert
upstream django{
server unix:/var/www/fileconvert/run/uwsgi.sock;
}
server {
listen 80;
server_name ec2_public_domain;
charset utf-8;
client_max_body_size 50M;
location / {
include /etc/nginx/uwsgi_params;
uwsgi_pass django;
}
}
If you need more information, I'll add it right away. thanks.
The problem is that csrf_token was not matched.
@ensure_csrf_cookie should be placed on the first line of the view.(under import)
And make sure ajax or axios csrf_cookie set in script.