I'm deploying my project,
I had no problem until i decided to buy a domain for my digital ocean droplet
i added the records from my namecheap domain to my droplet
i was working on it then suddenly when i want access to myproject/api it's now showing 502 errors
i'll give you all the informations so maybe you can help me with it
1 ) mongoDB atlas status : All good
; i even tried " npm start " to see if DB can't connect but it connects perfectly fine. I refreshed in .env the connecting string, it stills connect with no problems.
2 ) Nginx error.log shows this information i don't really understand, i guess it's the key point :
86 connect() failed (111: Connection refused) while connecting to upstream, client: 164.92.206.160, server: _, request: "GET /api/category/cinema HTTP/1.1", upstream: "http://[::1]:8000/api
3 ) The front is perfectly showing himself on my project domain url it starts showing 502 error when i click something using my DB/server.
4 ) i rebuilded and restarted front & back + nginx multiple times
5 ) i updated endpoints and .env variables to match with my fresh domain and it works, only the API side is breaking
6 ) nginx conf file :
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
server_name _;
location /api {
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
I tried barely everything and it's still not working as it was used to work.