Contenido del Curso
Introducción a la Computación en la Nube
Introducción a la Computación en la Nube
Servidor Web EC2
Usually, EC2 instances are used to host servers. These servers can perform various functions; it could be a web application server, an online gaming server, or a server with computational power that you can use for your tasks.
Simply put, you rent a computer located remotely, which is consistently maintained. This means you don't have to worry about your server and can focus on other things.
The point I'm getting at is that in this chapter, we'll see how to set up a web server on your instance and host our portfolio
HTML page.
Usualmente, las instancias EC2 se utilizan para alojar servidores. Estos servidores pueden realizar varias funciones; podría ser un servidor de aplicaciones web, un servidor de juegos en línea, o un servidor con potencia computacional que puedes usar para tus tareas.
En pocas palabras, alquilas una computadora ubicada remotamente, que se mantiene constantemente. Esto significa que no tienes que preocuparte por tu servidor y puedes concentrarte en otras cosas.
El punto al que quiero llegar es que en este capítulo, veremos cómo configurar un servidor web en tu instancia y alojar nuestra página HTML de portfolio
.
To install the httpd
server on your instance, use the following command:
To check if everything is installed correctly, use the following command:
Next, we need to ensure that httpd
will automatically start after the instance is rebooted.
To do this, we need to enable httpd
using the following command:
And we will get the response with httpd
file system and server location:
Great, you have successfully installed the Apache httpd Server on your instance. Now let's move on to hosting HTML pages on the web server.
Genial, has instalado con éxito el Servidor Apache httpd en tu instancia. Ahora pasemos a hospedar páginas HTML en el servidor web.
/path/to/your-key.pem
— the path to your private key;/local/path/to/your-file.html
— the path to the HTML file you want to transfer;ec2-user
— the standard username for Amazon Linux AMI;your-ec2-public-ip
— the public IP address of your EC2 instance.
Let's use this command to transfer our portfolio
HTML page.
Now let's switch to our instance console and check if the file has been transferred using the ls
command:
As you can see, the file has been successfully transferred to the directory we specified.
Colocando el Archivo en el Directorio del Servidor Web
Por defecto, el Servidor HTTP Apache en la mayoría de las distribuciones de Linux utiliza el directorio /var/www/html
para almacenar páginas web. Debes mover tu archivo HTML a este directorio usando el comando mv
:
Now our file is in the desired folder. All we need to do now is rename the file and start our server.
Iniciar el Servidor
Para renombrar el archivo, también podemos usar el comando mv
especificando los nombres de archivo antiguo y nuevo. Vamos a navegar al directorio donde se encuentra nuestro archivo y usar el comando necesario:
You can also check the contents of the file using the cat
command.
Now that our HTML file is in the desired directory, all we need to do is start the server.
This is done with the following command:
As you can see, the server is now active and ready to use.
To view our HTML page, you need to navigate to the public IPv4 address of your instance.
This is the website we've hosted:
Thus, we've installed a web server on our instance and hosted our HTML portfolio page on our server.
1. What software do you install on an EC2 instance to set up a web server?
2. How can you transfer an HTML file from your local computer to the EC2 instance?
3. Which directory is typically used by Apache HTTP Server to store web pages on most Linux distributions?
¡Gracias por tus comentarios!