On my ubuntu 20 server I have a website, frontend and backend on example.com and api.example.com domains respectively. example.com stopped responding to requests on its own, while the backend works. Also, if I change the example.com domain to, for example, v1.example.com, the site starts working, which is very strange for me.
nginx conf:
server { server_name example.com; proxy_connect_timeout 600; proxy_send_timeout 600; proxy_read_timeout 600; send_timeout 600; gzip on; gzip_proxied any; gzip_comp_level 4; gzip_types text/css application/javascript image/svg+xml; location / { proxy_pass http://localhost:3001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_cache_bypass $http_upgrade; }listen 443 ssl; # managed by Certbotssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbotssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbotinclude /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbotssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot} server { if ($host = example.com) { return 301 https://$host$request_uri; } # managed by Certbot# server_name *example.com*; listen 80;return 404; # managed by Certbot}
nginx itself doesnt show any errors
nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
/var/log/nginx/error.log also doesnt show errors:
2024/04/12 08:33:11 [notice] 219796#219796: signal process started
When I try to do curl -v example.com from my PC, it just doesn't reach. But on the server, it instantly displays the site data.
Tried recreating let's encrypt certificates (from certbot) and running without them, nothing helped.
Also my site is connected to cloudflare, but I tried disabling/enabling it, changing nameserver to the standard ones from namecheap, - the result is the same.
If I use dns lookup on my domain, it shows the cloudflare ip addresses, which is ok:188.114.96.3188.114.97.3
And if I try to verify the ssl certificate, it doesn't give anything good
(openssl s_client -connect example.com:443)CONNECTED(00000003)write:errno=104---no peer certificate available---No client certificate CA names sent---SSL handshake has read 0 bytes and written 315 bytesVerification: OK---New, (NONE), Cipher is (NONE)Secure Renegotiation IS NOT supportedCompression: NONEExpansion: NONENo ALPN negotiatedEarly data was not sentVerify return code: 0 (ok)---