This is my nginx sites available folder on a digital ocean Ubuntu v22 VPS:
server{ server_name 139.59.62.131 animeanyway.me;
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;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/animeanyway.me/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/animeanyway.me/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server{
if ($host = animeanyway.me) {
return 301 https://$host$request_uri;
} # managed by Certbot
}
previously, without ssl, it looked something like:
server{ server_name 139.59.62.131;
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;
}
}
and this version of code is way faster than the first one any idea why this is happening?
I tried messing around a lot with this file and sometimes it didnt work, and when it worked with http (second code I showed), it was fast, and when I enabled everything, it was extremely slow.
I dont know why is this happening, so any help will be appriciated!