I insist on encryption so this is what I use:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com ;
if ($request_method !~ ^(GET|HEAD)$ ) {
return 444;
}
return 301 https://$host$request_uri;
}
I only serve static pages so I use that filter. Obviously that is
optional. But basically every unencrypted request to 80 is mapped to an
encrypted request to 443.
On Thu, 4 Feb 2021 07:40:35 +0000
Adam <adam@monkeez.org> wrote:
> Hi all,
>
> nginx is running and listening on port 80:
> tcp 0 0 0.0.0.0:80 0.0.0.0:*
> LISTEN 0 42297 3576/nginx: master
> tcp6 0 0 :::80 :::*
> LISTEN 0 42298 3576/nginx: master
>
> The server responds fine to requests on port 443, serving traffic
> exactly as expected:
> tcp 0 0 0.0.0.0:443 0.0.0.0:*
> LISTEN 0 42299 3576/nginx: master
>
> However, it will not respond to traffic on port 80. I have included
> this line in my server block to listen to port 80:
> listen 80 default_server;
> listen [::]:80 default_server;
>
> My full config can be seen at https://pastebin.com/VzY4mJpt
>
> I have been testing by sshing to an external machine and trying telnet
> my.host.name 80 - which times out, compared to telnet my.host.name
> 443, which connects immediately.
>
> The port is open on my router to allow port 80 traffic. This machine
> is hosted on my home network, serving personal traffic (services
> which I use, but not for general internet use). It does respond to
> port 80 internally, if I use the internal ip address
> (http://192.168.178.43).
>
> I've kind of run out of ideas, so thought I would post here.
>
> Thanks in advance for any support.
>
> Adam
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx