"localhost" is not a topic. With that aside, I think your real problem is you are trying to jump stairs too fast.
When doing something for the first time, you have to start simple. Running a server on the local machine requires knowledge of several different things.
Each one of these topics can have its own sub topics that require further investigation if you're not already familiar with them.
So the answer to your question is to start simple. Break the problem down, figure out the simplest subset you can handle at a time, and tackle that. Once you figure it out, tackle the next step.