0

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.

Aphrim
  • 1
  • dev domain requires ssl only, its forced by the authority – djdomi Jan 30 '22 at 16:11
  • 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) – djdomi Jan 30 '22 at 16:13
  • 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. – Aphrim Jan 30 '22 at 16:18
  • yes, in case HsTs was already in place it will the that kind of issue – djdomi Jan 30 '22 at 16:20
  • I added ```listen 443 ssl; listen [::]:443 ssl;``` but it still fails to load. – Aphrim Jan 30 '22 at 16:23
  • Please add output of `nginx -T` to the question so we can see the full nginx configuration. – Tero Kilkanen Jan 31 '22 at 07:49
  • Here is the output (For some reason old pastebin link stopped working.) https://pastebin.com/2Pm3GPae – Aphrim Feb 02 '22 at 03:08

0 Answers0