By default, your client (Internet-Browser/Utility) will connect to your server using the default ports 80/443 when using HTTP or HTTPS.
Else, if you use, like in your case, i.e. http://client.mydomain.com:5000/file.txt, you will request that file as intended, as you configured here this server on port 5000 and the file will be served in case it exists.
If you already have a default server_name example like down below defined on port 80,
Example:
server {
#listen <PORT>
listen 80;
#server_name _invalid_name_for_default_server_
server_name _default_;
#location defines WHAT can/should be found WHERE
location / {
root /home/ubuntu/client-data;
}
}
While accessing your server using a domain name, it will usually connect to port 80 and then look for the configured server block with server_name to verify if it exists, else, if configured it will serve the default Page.
Your Block explained:
server {
#listen <PORT>
listen 5000;
#server_name domain_to.listen
server_name client.mydomain.com;
#location defines what can be found WHERE
location / {
root /home/ubuntu/client-data;
}
}
In case, you want to request it with client1.mydomain.com/myfile.txt:
Set "listen" to port 80. If you then connect to your server, it will resolve the server_name directive.
EG:
server {
listen 80;
server_name client1.mydomain.com;
location / {
root /home/ubuntu/client-data;
}
}
Additionally, if for whatever reason you want to like too, to listen for BOTH Ports:
server {
listen 80;
listen 5000;
server_name client1.mydomain.com;
location / {
root /home/ubuntu/client-data;
}
}
Please also read: https://nginx.org/en/docs/http/server_names.html
We hope we could help you, if you wanted to raise the maximum number of Clients, listen is the wrong one :-)