Guide: How to create a local web server in Windows?

Hello world, my name is Francisco, fcoterroba on the Internet and today I bring you an explanatory post to create a web server in Windows.

There are a multitude of reasons why we want to have a web server on our computer, from starting to study web development, setting up a CMS, sharing multimedia, etc.

Before starting, I note that this guide is used to set up a local web server, which you can access from any device connected to the same network as the server. If you want to learn how to open it to the public, let me know in the comments!

Mainly, in Windows there are two options.

One of them comes “native” in the operating system itself. It uses a private server (Microsoft-IIS) and is very simple, to mainly practice HTML, CSS and JS. You can add back-end programming languages such as PHP or MySQL later, but they do not come by default.

The other option is somewhat closer to the professional field, since it uses the Apache system, present in almost 40% of world servers. We are talking about WAMP (Web Apache MySQL PHP Acronym). I'll go into more detail about WAMP later. Now, let's get to the nougat.

MOUNT WEB SERVER WITH MICROSOFT-IIS

Microsoft-IIS is a set of services part of the Windows operating system.

In addition to setting up a web server, it allows the configuration of an FTP server (I will talk about it in another post)

To activate this feature, we must write “features” in the search bar and a square window will appear with the features that we have activated in Windows.

Features are “small functionalities” that, although they can be installed and configured, do not come standard with the operating system.

The feature that we must initialize to have a web server in Windows is mainly “Internet Information Services > World Wide Web Services”. Installing only that one would work, but you can also install the one above, Web Administration Tools to see the web console. Although for our purposes, it is not necessary. Specifically, the necessary ones are those marked in the image

Once we activate those, we click on the accept button and it will take a few minutes to activate. (Maybe it also asks for a restart)

And with this we would have a web server made. We can check it by typing “localhost” in our browser.

As you can see, a web page appears with a photo of Windows and the welcome in several languages.

But you probably weren't looking to create a web server to have this, so I'm going to explain how to change that page.

To replace this web page with the page you want, you first need to create the file.

I am not going to explain all of the HTML, but what is necessary to write “Hello World” is (ignore everything written between because they are comments to explain how it works):

<!DOCTYPE html> <!--Declara el tipo de archivo-->
<html lang="es" dir="ltr"> <!—Declara el lenguaje de la página y la direccionalidad del texto-->
  <head> <!—Comienza la cabecera, todo aquello que no se ve-->
    <meta charset="utf-8"> <!—Establece los caracteres usables-->
    <title>fcoterroba en un servidor Microsoft</title> <!—Es el título de la página, lo que aparece en la pestaña-->
  </head> <!--Cierre de la cabecera-->
  <body> <!—Comienzo del cuerpo del archivo, todo lo que se ve en la página-->
    <h1>HOLA MUNDO</h1> <!—H seguido de un número del 1 al 6 declara el tipo de encabezado-->
    <h1>OS SALUDA FCOTERROBA</h1>
    <a href="www.fcoterroba.com">VISITA MI WEB</a> <!--A es un enlace y href el atributo para indicar hacia dónde ir-->
  </body> <!--Cierre del cuerpo-->
</html> <!--Cierre del documento-->

You copy and paste that into your favorite notepad or code editor, rename it index.html and upload it to the server folder, which by default is: “C:\inetpub\wwwroot”

Now, if you reload localhost, the text will appear.

SET UP WEB SERVER WITH WAMP

WAMP is a software stack for Windows that includes Apache (web server), MySQL (database), and PHP (web back-end language).

This means, put together, that from a single program it installs the three main technologies that any website has today and without going deep into configuration files.

To begin, we download the executable in the repository page and install it. (Careful, it weights more than medium GB)

When the program is installed, an icon will be created on your desktop. The best thing to do would be to restart it to make it finish taking the changes, but it is not strictly necessary.

When we open the program, an icon will have been created next to the clock in the taskbar. If it is green, the server is working perfectly.

We will type localhost again in the browser to check how it works and we will also press the phpinfo() link to check that it is also installed.

To change this home page we modify the server index, which by default is installed at C:\wamp64\www

We delete all the existing content inside and replace it with what we have already found. We save the changes, update the browser and voilà.

And this has been all guys, I hope you found it interesting, leave me any doubts/ideas you have in the comments below.

Don't forget to follow me on Twitter, Facebook, Instagram and LinkedIn.
See you soon!

Leave a Reply

Your email address will not be published. Required fields are marked *