I am having a really annoying issue with my digitalocean droplet running nginx as my web server. UFW is disabled on it and HTTPS does work, but HTTP using CURL on my mac at home gives me connection refused (port 80)...

Here is my configuration for nginx:

# return 301 https://$host$request_uri;
server {
        listen 80;
        server_name creepinson.xyz www.creepinson.xyz;
        location / {
                return 301 https://$server_name$request_uri;

# https
server {
        root /var/www/html;
        server_name creepinson.xyz www.creepinson.xyz;
        index index.php index.html index.htm index.nginx-debian.html;
        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;

        location / {
            try_files $uri $uri/ $uri.php;
        listen 443 ssl;
        ssl_certificate /etc/letsencrypt/live/creepinson.xyz/fullchain.pem; # m$
        ssl_certificate_key /etc/letsencrypt/live/creepinson.xyz/privkey.pem; #$
        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

I am also using cloudflare for my domain. I tried using my ip and it gave me port 80 refused but on cloudflare it says 521. I have tried disabling UFW (firewall), resetting IPTables... And it also works perfectly on port 80 when I SSH into the VPS and run curl -v localhost but when I run curl from anywhere else it doesn't work, only https works. I just have no idea what the heck is wrong with my server. I also ran netstat -lntp | grep 80 and it results in the following:

tcp        0      0    *               LISTEN      8538/nginx: master


  • Check the IP address of your server that you set in CloudFlare. It is probably wrong. If that fails, turn off CloudFlare until you have fixed the problem. – Michael Hampton Apr 14 '19 at 22:41
  • I double checked the ip and it looks right, but I don't think cloudflare is the problem since it gives me the same error when I use the ip instead of the domain. – Creepinson Apr 15 '19 at 0:19
  • You appear to still have CloudFlare enabled for these DNS names. – Michael Hampton Apr 15 '19 at 0:53
  • Yeah, I know. I said I double checked the ip and it's correct. So what else should I do? – Creepinson Apr 15 '19 at 1:26
  • Weird... I clicked the Run through cloudflare button in my cloudflare DNS settings and it worked. – Creepinson Apr 15 '19 at 1:38

I solved it by disabling cloudflare temporarily and then re-enabling it... I don't why it worked but it works :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.