0

I have a domain myfunkyserver.com (not the real name). The domain is supposed to send the connection to a VPS located in godaddy's data centers. The server is running nginx on alma linux, and has the following configuration which is supposed to redirect http://myfunkyserver.com requests to https://myfunkyserver.com. Then, when it receives a request through https protocol, it proxy passes the request to port 3000 where a nodejs server is running the actual web app.

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        '$status $body_bytes_sent "$http_referer" '
        '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    

    include /etc/nginx/conf.d/*.conf;

    server {
        server_name myfunkyserver.com; 
        root         /usr/share/nginx/html;
        include /etc/nginx/default.d/*.conf;
        location / {
            proxy_pass http://localhost:3000;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
        }
        ssl on;
        listen [::]:443 ssl ipv6only=on; 
        listen 443 ssl; 
        ssl_certificate /etc/ssl/certs/bundle.crt;
        ssl_certificate_key /etc/ssl/certs/myfunkyserver.com.key;
    }

    server {
        listen       8080 ;
        server_name myfunkyserver.com;
        return 301 https://$host$request_uri;
    }
}

The connection to the server is working fine as long as connections are through the https protocol. Typing www.myfunkyserver.com will sometimes work, and sometimes not work. I've isolated the issue to a request to http://myfunkyserver.com. When this is sent, the server does not respond.

I have narrowed this issue to one of two places:

  1. A broken configuration above, or maybe bad firewall configuration
  2. More likely, a domain issue.

Historically, this domain was set up to forward to a user.github.com page, which I believe utilized http protocol. I could revise this question if there is pertinent domain settings one would need to help with this question.

1
  • Change "listen 8080" to "listen 80".
    – Vadim
    Commented Jul 10 at 8:16

1 Answer 1

1

I found the issue.

#1: verified that the A record does not care about http vs https: DNS for HTTP vs HTTPS

After referring to the default port #'s here: https://docs.oracle.com/en/storage/tape-storage/sl4000/slklg/default-port-numbers.html I was able to see my mistake:

 server {
        listen       8080 ;
        server_name myfunkyserver.com;
        return 301 https://$host$request_uri;
    }

Godaddy was attempting to connect to port 80, which was not configured to be open. Replaced the last part with this configuration, restarted, and http seemed to work much better.

 server {
        listen       80 ;
        server_name myfunkyserver.com;
        return 301 https://$host$request_uri;
    }

I hope this helps someone else who may run into the same problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .