MDN wants to learn about developers like you:

Traducción en curso

En este articulo veremos que son los servidores, como trabajan, y porque son tan importantes.

Prerequisitos: Debes saber como funciona internet, y entendiendo la diferencia entre pagina web, sitio web, servidor y motor de busqueda
Objetivo: Aprender que es un servidor web y conocer su funcionamiento funcional.


"Servidor web" podemos referirnos a hardware o software, o a ambos trabajando juntos.

  1. En cuanto a hardware, un servidor web is una computadora que almacena los archivos que companen un sitio web (ej.  documentos HTML , imagenes, hojas de estilos CSS y archivo JavaScript) y los entrega al dispositivo del usuario final. Esta conectado a internet y es accesible atraves de un nombre de dominio como
  2. En cuanto a software, un servidor web tiene muchas partes encargadas del control sobre como tienen acceso los usuarios a los archivos, por lo menos un servidor HTTP. UN servidor HTTP es una pieza de software que comprende URLs (direcciones web) y HTTP (el protocolo que tu navegador usa para ver las paginas web).

Al nivel más basico, siempre que un navegador necesite un archivo almacenado en un  servidor web, el navegador lo solicita via HTTP. Cuando la peticion llega al servidor web correcto (hardware), el  servidor HTTP  (software) envia el archivo antes solicitado, tambien a través de HTTP.

Basic representation of a client/server connection through HTTP

´Para publicar un sitio web, necesitaras un servidor web dinamico o estatico.

Un servidor web estatico, o pila, consiste en una computadora (hardware) con un servidor HTTP (software). llamamos a este "estatico" debido a que el servisor envia los archivos almacenados "tal cual" a tu navegador.

Un servidor web dinamico consiste en un servisor web estatico con un software extra , lo mas comunes que sea una aplicación servidor y una  base de datos. Llamamos a esto "dinamico" por que la aplicacion servidor actualiza los archivos almacenados antes de enviarlos mediante el servidor HTTP.

Por ejemplo, para ver la pagina que ves en tu navegador finalmente, el servidor aplicacion puede mostrar el diseño HTML con contenido desde una base de datos. sitios como MDN or Wikipedia tienen cientos de paginas web, pero estas no son realmente archivos HTML, se trata de una estrucura HTML y una gigantesca base de datos. Esto hace mas facil y rapido el mantenimiento y entrega del contenido.

Active learning

There is no active learning available yet. Please, consider contributing.

Deeper dive

To fetch a webpage, as we already said, your browser sends a request to the web server, which proceeds to search for the requested file in its own storage space. On finding the file, the server reads it, processes it as needed, and sends it to the browser. Let's look at those steps in more detail.

Hosting files

A web server first has to store the website's files, namely all HTML documents and their related assets, including images, CSS stylesheets, JavaScript files, fonts, and videos.

Technically, you could host all those files on your own computer, but it's far more convenient to store them all on a dedicated web server that

  • is always up and running
  • is always connected to the Internet
  • has the same IP address all the time (not all ISPs provide a fixed IP address for home lines)
  • is maintained by a third-party provider

For all these reasons, finding a good hosting provider is a key part of building your website. Dig through the various services companies offer and choose one that fits your needs and your budget (services range from free to thousands of dollars per month). You can find more details in this article.

Once you set up a web hosting solution, you just have to upload your files to your web server.

Communicating through HTTP

Second, a web server provides support for HTTP (Hypertext Transfer Protocol). As its name implies, HTTP specifies how to transfer hypertext (i.e., linked web documents) between two computers.

A protocol is a set of rules for communication between two computers. HTTP is a textual, stateless protocol.

All commands are plain-text and human-readable.
Neither the server nor the client remember previous communications. For example, relying on HTTP alone, a server cannot remember a password you typed or what step you're on in a transaction. You need an application server for tasks like that. (We'll cover that sort of technology in further articles.)

HTTP provides clear rules for how a client and server communicate. We'll cover HTTP itself in a technical article later on. For now, just be aware of these things:

  • Only clients can make HTTP requests, and then only to servers. Servers can only respond to a client's HTTP request.
  • When requesting a file via HTTP, clients must provide the file's URL.
  • The web server must answer every HTTP request, at least with an error message.

The MDN 404 page as an example of such error pageOn a web server, the HTTP server is responsible for processing and answering incoming requests.

  1. On receiving a request, an HTTP server first checks whether the requested URL matches an existing file.
  2. If so, the web server sends the file content back to the browser. If not, an application server builds the necessary file.
  3. If neither process is possible, the web server returns an error message to the browser, most commonly "404 Not Found". (That error is so common that many web designers spend quite some time designing 404 error pages.)

Static vs. dynamic content

Roughly speaking, a server can serve either static or dynamic content. "Static" means "served as-is". Static websites are the easiest to set up, so we suggest you make your first site a static site.

"Dynamic" means that the server processes the content or even generates it on the fly from a database. This solution provides more flexibility, but the technical stack becomes more difficult to handle, making it dramatically more complex to build the website.

Take for example the page you're reading right now. On the web server hosting it, there is an application server that takes article content from a database, formats it, puts it inside some HTML templates, and sends you the results. In this case, the application server is called Kuma and is built with Python (using the Django framework). The Mozilla team built Kuma for the specific needs of MDN, but there are many similar applications built on many other technologies.

There are so many application servers that it's pretty hard to suggest a particular one. Some application servers cater to specific website categories like blogs, wikis or e-shops; others, called CMSs (content management systems), are more generic. If you're building a dynamic website, take the time to choose a tool that fits your needs. Unless you want to learn some web server programming (which is an exciting area in itself!), you don't need to create your own application server. That's just reinventing the wheel.

Next steps

Now that you are familiar with web servers, you could:

Etiquetas y colaboradores del documento

 Colaboradores en esta página: flaki53, welm
 Última actualización por: flaki53,