Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Digital Literacy

James Welch
James Welch
10,363 Points

REALLY confused - Web server

Hey everyone! Hope all is well :-) I'm sorry to post this however I've hit a massive brick wall.

I recently learned about web servers on MDN before starting back-end. It mentions that "A dynamic server is a static server with extra software like a database and an application server".

After frustrating hours of being overwhelmed and confused, I still have no idea what an application server is, I've heard it's inside a web server.. it contains a web server, and even that they are both completely different!

Simple, straightforward question: Will I be using an application server when coding on the server side such as with node.js or PHP?

I understand what a web server does, and I get the fundamentals of databases, but I've started to doubt myself. It really makes me want to pick up my christmas tree and throw it in my neighbours garden.

The idea of a blog, or a news site (i.e, gaming articles) makes me think that I need to code the back end so that I can easily just fill out a form, click submit and boom, the web server processes it, fills out a HTML template and sticks it on the site. The problem suddenly appears now, since I'm doubting myself. I don't want to use a CMS, I'd like to gain back-end knowledge and code everything for experience. Will I need to create a separate web page (admin panel) to fill out a form which will (when submitted) run the back end code, or is the admin panel provided by hosting sites (Like cpanel from godaddy) used for this?

I had everything planned out until I read this web server guide from MDN. It's 2 am and I'm going mentally insane!

Happy coding! Take care :-)

Petros Sordinas
Petros Sordinas
16,181 Points

Hi James,

Overwhelmed and confused? Don't worry, that is a good thing. It means you are thinking about stuff, not taking everything other people say for granted :)

Quick answer to your question: Yes, you will be using an application server - in fact, you will be making it work.

I'll try an make things clear for you:

A server does what it names implies - it serves. A client requests something to be served from the server. Same way you go to a coffee shop (as a client) and request something (a coffee) from a barista (the server).

With computer networks (be it the internet or a local area network in the office), you have clients that request information (or something to be done with some information) and servers that receive these requests and deliver.

A server can be anything from a simple pc to a huge cluster of CPUs somewhere around the world. A server can also be a client to other servers. Vice versa, a client machine can also act as a server.

While there are specifications for machines destined to become servers, basically any computer can be a server. So what actually makes a server? The software it runs, usually referred to as a service.

So, lets say you want to write a news site using a popular CMS like wordpress. If you expect your site to be small, i.e. have a small number of visitors with a small amount of content delivery, your site will need the following servers (services):

  • Web server, to receive and send http requests. Typically, that would be run on Apache or nginx.
  • Database server, to store posts and articles. Typically that would be mySql or SQLite.
  • Application server, to translate the http requests to input for your database or output for the web server. Generally, all functions your web site or web app will have to do. This is your CMS, typically wordpress.

If you want to write your own CMS with PHP, Ruby or Node, you will be making the application service. You will be communicating with the database server and the web server, on the level of your language of choice. A php 'echo' statement sends information to the web server, a GET or POST receives information from the web server. A call to PDO communicates with the database server.

As mentioned earlier, if your site is small, all these servers (or services) are installed on one machine. If you try to setup a virtual server on your pc or use a VPS, you will encounter the term LAMP stack, which is an acronym for Linux, Apache, MySQL and PHP. You need all these servers (services) to run a dynamic web site. If you choose to host your website or app on a shared hosting account (like those offered by Godaddy or Bluehost), these services are installed by your hosting provider. You don't have to worry about server setup, you know that these services are available to you on some server or servers.

If your site is going to become large and serve thousands of visitors, you might have to keep your services in different servers. One server for the database, another for the app or some app specific service etc. Things like load balancing, backup servers etc come into play here which are more advanced topics.

If you want to learn how to make dynamic web apps (like a CMS), follow the php or ruby courses on treehouse. Start experimenting. You will fail in the beginning, but that is the learning process. For the learning process, I suggest you try to re-invent the wheel. If you just want to make a site for business or other purposes, a basic knowledge of wordpress (setting up, installing plugins and themes) is sufficient.

Hope I've helped.

1 Answer

James Welch
James Welch
10,363 Points

Petros Sordinas - It doesn't let me reply but this explanation has cleared a lot up. Thanks a tonne! :-)