Once upon a time the web was static. It means webservers were able to serve files from a filesystem via http, much like FTP servers serve files via FTP. First attempts to go dynamic were CGI scripts, which were good for small projects but for bigger ones they would still hurt - in performance and in code maintenance.
One of the alternatives was to have the webserver forward requests to applications running elsewhere/in other processes. One such example is JServ, which was the first servlet container. It was able to run servlets but not serve static files. So you would use it to process dynamic content only.
There you go: You have a webserver for static files, and an application (server) to care about dynamic content.
It did not take long until someone created a servlet that would serve static files - yet a lot of websites still make the distinction as serving static files would cost less resources with a plain webserver.
The resource overhead is not that painful today, and thus you can use application servers as replacements for webservers. And still webservers are commonly used before application servers, simply to reduce the facade on the web and thus possible attack vectors.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…