I have deployed Vue.js and Django E-commerce on VPS, where I set up Nginx and Gunicorn. All pages are working fine, all pages from Vue.js and the Admin area of Django. But when it comes to use forms and basically do anything related with /api/v1/ it gets ERROR 502. What could be wrong? I have no idea how to solve that and I've been having this error for over a few days. Hope you could help. Thank you!
Here is my Nginx:
upstream perulab_app_server {
server unix:/webapps/perulab/venv/run/gunicorn.sock fail_timeout=0;
}
server {
listen 8000;
listen [::]:8000;
server_name 172.16.7.52;
client_max_body_size 40M;
location / {
root /webapps/perulab/web-frontend/dist;
try_files $uri /index.html;
}
location /static/ {
root /webapps/perulab/web-backend;
}
location /media/ {
root /webapps/perulab/web-backend;
}
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://perulab_app_server/api/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_redirect off;
}
location /admin/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://perulab_app_server/admin/;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_redirect off;
}
}