Trouble setting up SSL

Thomas Ward teward at thomas-ward.net
Mon Sep 5 00:10:40 UTC 2022


Is this on a VPS?  They might have and additional firewall on the hosting side you need to adjust.

If this is behind a routwer and you are outside the network make sure to port-forward port 443.



Sent from my Galaxy



-------- Original message --------
From: Brian Carey <biscotty666 at gmail.com>
Date: 9/4/22 19:55 (GMT-05:00)
To: nginx at nginx.org
Subject: Re: Trouble setting up SSL


Thanks so much for your reply. See answers below.

On 9/4/22 17:48, Moshe Katz wrote:
Here are a few things you can check (all of these need to be run as root or using `sudo`):

Is nginx actually listening on port 443? There are lots of different commands you can use to check this, but I like to use `netstat -lptn | grep nginx`.

root at biscotty-lt:/etc/nginx/conf.d#<mailto:root at biscotty-lt:/etc/nginx/conf.d#> netstat -lptn | grep nginx
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      58325/nginx: master
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      58325/nginx: master
Is there an error in your config? Check this with `nginx -t`.

root at biscotty-lt:/etc/nginx/conf.d#<mailto:root at biscotty-lt:/etc/nginx/conf.d#> nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful


Have you allowed port 443 through your firewall? Check `/var/log/syslog` for firewall messages.
I've disabled the firewall until I get this resolved.

On Sun, Sep 4, 2022, 7:27 PM Brian Carey <biscotty666 at gmail.com<mailto:biscotty666 at gmail.com>> wrote:
Hi,

I'm pretty new to nginx but do have a server up and running. I've been
pulling my hair out over ssl setup though. I have read the docs on your
server and some others like the alpine site. The most recent attempt I
followed the video tutorial on your website. Whenever I try to connect
via ssl it hangs.  I hope someone here has some ideas because I don't
know where else to turn.

No errors show in the nginx logs.

I'm running Ubuntu 20.04. Nginx was installed following the instructions
on your website.

When I try to access http://www.biscotty.dev with curl I get a response.
If I explicitly request https it hangs indefinitely. The
commands/responses are posted below.

Not sure if this matters but I have learned that dev domains try to
enforce https, so explicitly using http in a browser gui craps out no
matter what, but curl ignores this and serves you via http anyway. I
don't know if this matters but I thought I would mention it.

Here is my .conf file. I have not modified anything else from the
initial install.

'''
server {
listen 80 default_server;
server_name www.biscotty.dev<http://www.biscotty.dev>;
return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;
server_name www.biscotty.dev<http://www.biscotty.dev>;

ssl_certificate /etc/nginx/ssl/biscotty.dev<http://biscotty.dev>.crt;
ssl_certificate_key /etc/nginx/ssl/biscotty.dev<http://biscotty.dev>.key;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
'''
'''
root at biscotty-lt:/etc/nginx/conf.d#<mailto:root at biscotty-lt:/etc/nginx/conf.d#> curl -I http://biscotty.dev
HTTP/1.1 301 Moved Permanently
Server: nginx/1.23.1
Date: Sun, 04 Sep 2022 21:05:01 GMT
Content-Type: text/html
Content-Length: 169
Connection: keep-alive
Location: https://www.biscotty.dev/

root at biscotty-lt:/etc/nginx/conf.d#<mailto:root at biscotty-lt:/etc/nginx/conf.d#> curl -I https://biscotty.dev
^C
```


_______________________________________________
nginx mailing list -- nginx at nginx.org<mailto:nginx at nginx.org>
To unsubscribe send an email to nginx-leave at nginx.org<mailto:nginx-leave at nginx.org>



_______________________________________________
nginx mailing list -- nginx at nginx.org<mailto:nginx at nginx.org>
To unsubscribe send an email to nginx-leave at nginx.org<mailto:nginx-leave at nginx.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20220905/5ec6fdb1/attachment.htm>


More information about the nginx mailing list