其实只需要修改配置文件nginx.conf,在server中添加location就好

server {
        listen       80;
        server_name 你的域名或ip,例:www.baidu.com;

        location / {
            root   html;
            index  index.html index.htm;
        }       

        location /aaa {
            root   html;
            index  index.html index.htm;
            proxy_pass http://服务器A:8080/;
        }
        
        location /bbb {
            root   html;
            index  index.html index.htm;
            proxy_pass http://服务器B:8080/;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

实现的效果就是
访问 www.baidu.com/aaa 访问的是服务器A的8080端口
访问 www.baidu.com/bbb 访问的是服务器B的8080端口

红色警告:下面是443的绑了证书的,不需要的当没看到就好了

一、首先监听80端口,跳到443

server {
        listen       80;
        server_name 你的域名或ip;
        rewrite ^/(.*)$ https://你的域名或ip:443/$1 permanent;

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

    server {
        listen       443 ssl;
        server_name  域名/ip;
        ssl on;
        ssl_certificate      手动隐藏路径/fydsoft.club.pem;
        ssl_certificate_key   手动隐藏路径/fydsoft.club.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location / {
            root   html;
            index  index.html index.htm;
        }
  
        location /aaa {
            root   html;
            index  index.html index.htm;
            proxy_pass http://服务器A:8080/;
        }
        
        location /bbb {
            root   html;
            index  index.html index.htm;
            proxy_pass http://服务器B:8080/;
        }
    }