I have the following server blocks...
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /run/nginx.pid;
events {
    worker_connections 1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       443 ssl http2;
        listen       [::]:443 ssl http2;
        include      snippets/self-signed.conf;
        include      snippets/ssl-params.conf;
        server_name  secondave.net www.secondave.net;
        location / {
          proxy_pass http://localhost:3000;
        }
    }
    server {
        listen 80;
        listen       [::]:80;
        server_name  _;
        location / {
          proxy_pass http://localhost:3000;
        }
    }
}
However I would expect this to work...
    server {
        listen       443 ssl http2;
        listen       [::]:443 ssl http2;
        include      snippets/self-signed.conf;
        include      snippets/ssl-params.conf;
        server_name  secondave.net www.secondave.net;
        location / {
          proxy_pass http://localhost:3000;
        }
    }
    server {
        listen 80;
        listen       [::]:80;
        server_name  _;
    }
But if I try to do it this way the reverse proxy doesn't work anymore. Why is it requiring the proxy_pass both places?
Here is me trying to call the endpoint without the proxy_pass in the port 80 block as well...
[ec2-user@... nginx]$ curl --insecure https://secondave.net
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
Notice the Welcome to nginx!, this is not what the proxied site says. When I add it back again I see the expected site again...
[ec2-user@... nginx]$ sudo vi nginx.conf 
[ec2-user@... nginx]$ sudo systemctl restart nginx
[ec2-user@... nginx]$ curl --insecure https://secondave.net
<!DOCTYPE html><html><head><meta charSet="utf-8"/><title>THEJa
This is using AWSLinux2023 which I believe is part of selinux and nginx is installed using yum.
Additional Info
[ec2-user@... ~]$ cat /etc/nginx/nginx.conf 
...
http {
    ...
    server {
        ...
    }
    server {
        listen 80;
        listen       [::]:80;
        server_name  secondave.net www.secondave.net;
        return 404;
    }
        
}
[ec2-user@... ~]$ sudo systemctl restart nginx
[ec2-user@... ~]$ curl --insecure https://secondave.net
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.22.1</center>
</body>
</html>