You start with the router
You set a fixed IP for the the PI you then set the router to let the PI be a web server you can give it a name.
The router handles the name server most can do that
Then you set the PI up with the name and IP your setup on the router
You set Apache up to the same.
You add what you need to Apache and then to start the road to coding the stuff you need mutt php database
https://www.raspberrypi.org/documentation/remote-access/web-server/apache.md
You can do anything you like once you get the hang of it
mutt is a powerful thing I really look at it
Here something to play with