The intent here is to try to outline some of the background and vocabulary necessary for setting up your own servers. The problem is not that any single step is especially difficult, it is that there are many steps, several of which are, for lack of a better descriptive word, arcane.
The first thing we need to sort out before progressing is vocabulary. Obviously, the first two words we need to come to terms with are those in the title, server and domain. We also will have to understand about ports and IP-addresses. I'll give you definitions of these words that I think are most useful for our purpose, but you should be aware that almost all these words have equally valid, but not identical, definitions that others may use.
So, what is a server? A server is a machine or program that provides a service for it's clients. It's clients can be other machines or programs. The typical restaurant is run on a client-server model. Each client does not come in and request or reserve time in the kitchen and prepare his own meal. Instead, the clients come in with their requests, a server (in American English usually called a waiter) comes over, takes their order, passes the job of cooking their food to the cooks, passes the job of setting up their dishes and silverware to the bus-boys (maybe called bus-persons these days), and finally arranges to have their order brought to their table.
There are many examples where the server-client model is useful. Three immediately come to mind: In the first, someone wants to set up a webhosting business and have 60,000 clients pay him/her to host their websites. Such a person would want a server capable of multiple simultaneous high-speed connections with the ability to rapidly process commands. He would not invest much is the server's GPU (graphical processing unit) because none of his 60,000 clients would see his server's screen.
In a second example, a person might have a small business with maybe 5 to 50 employees, each with his/her own pc. The owner may want to set up a server that will enable all his employees to communicate and share information, while at the same time, preventing outsiders from accessing that private information. If this is your goal, you may learn some useful information by reading further, but keep in mind that I don't know how to do what you need.
It is a third and simplest example in which I succeeded and am willing to share my experience with you. I simply got tired of paying other people to handle my servers only to find they were not especially helpful, and sometimes not even sympathetic, when any problems arose.
At the outset, it is important to note that servers do not have to be on a separate computer. As stated above, a server in many cases is just a program that serves other programs. I put my server software on a separate computer because I had a computer not being used and I thought, rightly or wrongly, that if someone hacked my servers because I made mistakes in setting them up, they would have to work harder still to hack the computer that had all my personal files and data.
When personal computers started to proliferate, along with the desire to allow them to communicate with each other over a series of wires or radio frequencies, it was decided that a convenient way to do this was to assign each computer or device on the Internet a numerical address, which was referred to as an IP address. The address format was four decimal integers between 0 and 255, separated by three periods.
This immediately created a new problem. When you tell your friend to check out your website and he asks "How?" you are not going to tell him "Type into your browser 'aitch tee tee pee, colen, slash, slash, one seventy two period one thirty four period sixty seven period two twenty eight." So the idea of assigning domainnames to people or groups of people arose so you could tell your friend "Point/navigate your browser to www.mydomainname".
You could not have two separate groups getting the domainname "ibm.com", so the United States government set up five or six top level domains like ".gov", ".com", ".edu". ".org", etc, and gave the authority to several entities to assign unique domainnames (for a fee) under the top-level-domains. At the same time, maintainers of the Internet created name servers that when sent a domainname query would respond with the IP address that handled that domainname.
The original domainname system was thought to be too un-democratic, too limiting, or too much under control of the US, so it was changed and there now are dozens of top-level-domains, the majority assigned by countries other than the US. But, the concepts I outlined above, I believe, still apply and are useful.
If every connected device has an IP address, clearly IP addresses are very important to the functioning of computers. As such, the word, IP-address, has many qualifiers. Someone figured out that you don't need enough unique IP addresses for every computer in the world, only enough for those that need to be functioning simultaneously. Thus the idea of dynamic IP-addresses arose. These are IP-addresses that are assigned as needed and a given computer might not have the same IP address each time it connects to the Internet. In my opinion, the distinction between static and dynamic IP-addresses, is pretty arbitrary and not very important. First of all, at least for the ISPs I have used, my dynamic IP-addresses have remained fixed for long periods. Secondly, if you contract with one company to assign you a static IP-address and then switch to another company to do the same, your so-called static IP-address will change. I assure you, everything I describe here can be done with a dynamic IP-address. The relevant IP-addresses do not need to be fixed, they just need to be known to the domain name system so someone wanting to connect to your computer can look the current IP-address up. There are companies you can contract with to update the domain name system everytime your IP-address changes or you can do it yourself by contacting your domain name registrar.
As suggested above, Domain Name Service can be thought of as a generic term for the world-wide system, composed of many thousands of individual name servers, designed communicate with eacvh other and keep track of the IP-address assigned to a given domainname at a given instance in time. To ensure that the Domain Name Service knows of your computers, you can set up your own name servers and tell some authority their ip-addresses, you could contract with so-called Dynamic DNS servers to keep track of your IP-address, even if it changes, or you could do what I did, which was to tell the Domainname Registrar that assigned my domaniname to me, what the current IP address of my domainname is. It didn't happen very often, but I got tired of having to log in to my Domainname Registar account every time my IP-address changed, so I decided it was worth a few extra dollars per month to request that my ISP assign my computer a static or fixed (unchanging) IP-address.
While the distinction between a dynamic or static IP-address may not be super important, there is another adjective applied to IP-addresses that is extremely important to understand if you wish to set up your own servers. Unfortunately, there is not agreement upon which adjectives to use. I prefer the terms external and internal IP-addresses. Others prefer the terms public and private.
It is actually easier to consider a concrete example than to continue discussing things in general terms. I possess four smart computing devices; two PCs, a printer, and a modem/router. I want both PCs to be able to communicate with the printer and also with the modem/router. The computer software and the router function of the modem/router know how to handle this. The router also knows when you need to communicate with your ISP for Internet access and it knows the IP-address that your ISP has assigned to your computer at that moment. This IP-address is your public or external IP-address, depending upon which term you prefer. Each of your smart/computing devices also has an IP-address, which I think is assigned by the router. By default, the router makes sure that these internal or private IP-addresses are available to devices on your local network of smart devices, but not to any external devices, since normally, no external devices need to access your computer.
If you are even slightly ahead of me, you already have realized that you cannot run a server program on a computer behind a router with the default configuration, since none of the requests, except those from your ISP, that impinge upon the router from external computers, will be forwarded to the relevant server. So if you are setting up server programs on one of the computers connected to your router, you need to specifically configure your router and tell it the internal IP-address of that computer. And since legitimate requests for each service come only on a limited number of specific ports among the few thousand the typical computer has, you also need to tell the router which ports to forward. The exact procedure for doing this depends upon your specific router. What you need to configure is generally referred to as NAT- or port-forwarding and you can consult your router's manual or the Internet on how to do this.
Not only must the router be configured to forward the signals that arrive on specific ports from external computers to the computer that has your server, the computer with the server must have those ports open for listening. If you are using firewall software on the computer that has your server software, you have to configure this correctly to allow this. To rephrase, if you configure your server software correctly, it will listen and and transmit data on the proper ports. However, the firewall program on the computer that has the server program may prevent the ports from actually transmitting the data. A useful linux command for seeing which ports are open for listening on a server is "sudo lsof -nP -iTCP -sTCP:LISTEN". In adddition, there are several websites that you can navigate to that will detect your external IP-address and test and report which ports are open.