Score:0

Nginx failing to listen for requests, fails to connect

cn flag

so I am trying to host a website with nginx. For the first month it was working, until I tried to add a new domain. By default the domain was not working ( It was just showing content of the default server block ), and certbot was failing to authenticate it, so I tried to remove all certs and try again, but that screwed everything up and nothing works now. It fails to connect to any of the domains. I got rid of the port 443 and all that in the server blocks and it still doesn't work, even though it says that it is listening on port 80. I have also allowed port 80 and 443 through the firewall as well as allowed nginx through. Here is the sites-enabled/default config:

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

        server_name aphrim.dev www.aphrim.dev; # managed by Certbot
        root /var/www/aphrim.dev/html;
        index index.html index.htm index.nginx-debian.html;

}

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


    server_name projects.aphrim.dev; # managed by Certbot
    root /var/projects/aphrim.dev/html;
    index index.html index.htm index.nginx-debian.html;

}

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

    server_name techchan.org; 
    root /var/projects/aphrim.dev/html;
    index index.html index.htm index.nginx-debian.html;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:3002;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Any help or ideas would be greatly appreciated, I have spent the past day trying to get this working, but to no avail.

Some other weird things, before deleting the certs, if I were to put 443 listener on the new domain, it worked fine, but was still unable to access through http/port 80. I am also unable to gen the certs as it says there is a connection timeout when trying to authenticate.

djdomi avatar
za flag
dev domain requires ssl only, its forced by the authority
djdomi avatar
za flag
Does this answer your question? [Do I need an SSL certificate for a .DEV TLD on an MX record?](https://serverfault.com/questions/1020959/do-i-need-an-ssl-certificate-for-a-dev-tld-on-an-mx-record)
Aphrim avatar
cn flag
I see, that explains the non functions .dev domain, but I still do not understand how I am supposed to get ssl on it as I can't get the cert as it gets a connection timeout while authenticating, also the .org domain does not work either. After enabling port 443 and ssl on the .dev domains, my browser tells me connection refused and reset.
djdomi avatar
za flag
yes, in case HsTs was already in place it will the that kind of issue
Aphrim avatar
cn flag
I added ```listen 443 ssl; listen [::]:443 ssl;``` but it still fails to load.
us flag
Please add output of `nginx -T` to the question so we can see the full nginx configuration.
Aphrim avatar
cn flag
Here is the output (For some reason old pastebin link stopped working.) https://pastebin.com/2Pm3GPae
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.