Report this

What is the reason for this report?

Curl can download Nginx Virtual Host Site but browser gets connection refused

Posted on July 1, 2019

I have configured nginx according to this tutorial and additionally I have changed the location to reverse proxy to my nuxt.js application on localhost:3000 according to this tutorial. I can

curl -i sevenlotus.co:80 

and it returns the full header of the site plus all of the html and css. Header is

HTTP/1.1 200 OK
Server: nginx/1.14.0 (Ubuntu)
Date: Mon, 01 Jul 2019 00:04:41 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 301997
Connection: keep-alive
ETag: "49bad-bEI6OAceinKEf1RyUfL3hbl/M3k"
Accept-Ranges: none

If i access sevenlotus.co through the browser I get ERR_CONNECTION_REFUSED.

I cannot for the life of me figure out what is wrong. My /etc/nginx/sites-available/sevenlotus.co file is the following

server {
        listen 80;
        listen [::]:80;

        root /var/www/sevenlotus.co/html;
        index index.html index.htm index.nginx-debian.html;

        server_name sevenlotus.co www.sevenlotus.co;

        location / {
                #try_files $uri $uri/ =404;
                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;
        }
}

There is a proper sysmlink in /etc/nginx/sites-enabled/. I tested the setting the location in the default server and I can access the site no problem (using the ip address of the machine). But if I go through the virtual host then I cannot connect via browser.

What am I missing?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This question was answered by @seanaye2:

SOLVED: I used certbot to automatically add an SSL certificate to my site. I also added the www.sevenlotus.co hostname in my DNS settings as I only had sevenlotus.co before. I’m not sure which of these fixed the problem but the site now functions as expected.

View the original comment

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.