Nginx reverse proxy other ports

assume that VPS IP is 44.55.66.77 , domain name is mydomain.com , VPS system is debian 9
VPS make install installed nginx,nginx version is 1.15.1 Maginx runs on 80 port, at first nginx.conf is like this,

...
http {
    server {
        listen 80;
        server_name mydomain.com;
        location / {
            root html;
            index index.html index.htm;
        }
    }
}
...

now you want to achieve the second-level domain name effect through nginx proxy other ports, such as more.mydomain.com pointing to 8090 port. The configuration is like this,

server {
    listen 80;
    server_name more.mydomain.com;
    location / {
        proxy_pass http://127.0.0.1:8090;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        root /usr/local/nginx/html;
        index index.html index.htm;
    }
}
After

nginx reload, visit more.mydomain.com prompt cannot find the server IP address .
is there a problem with this way of writing? In addition, how to act as an agent after adding ssl module to nginx?

-sharpnginx.conf
server {
    listen 80;
    server_name mydomain.com;
    
    return 301 https://$host$request_uri;
}
Mar.30,2021

regular server is written like this:
server {

    listen       8181;
    server_name  localhost;

    -sharpcharset koi8-r;

    -sharpaccess_log  logs/host.access.log  main;

     root   E:/BsConfig/zhy_webclient;
    index  index.html;

    location /ma {
    proxy_pass http://localhost:9090;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

  
}
Menu