Hosting Flashcards
What is Apache in the context of web hosting?
Apache is one of the most established web servers used to host websites and web apps.
What are the two types of proxies used in hosting?
Forward proxy and reverse proxy.
What is a forward proxy?
A server that sits between clients and the internet, forwarding requests from clients to web servers.
What is a reverse proxy?
A server that sits in front of web servers, forwarding client requests to them and sending responses back to the client.
What is NGINX commonly used for?
NGINX is used as a reverse proxy for load balancing, SSL termination, and caching.
What does the Apache Dockerfile do?
It creates a Docker image that uses Apache to serve an HTML file on port 80.
What is the content of the Apache Dockerfile?
It uses the httpd:latest base image, copies index.html to the default document root, and exposes port 80.
How do you build the Apache Docker image?
docker build -t apache-image .
How do you run the Apache container?
docker run –name apache-container -p 8081:80 apache-image
Why do we use port 8081 instead of port 80?
Because ports below 1024 are restricted; 8081 is an available unprivileged port.
How do you access a running Apache container’s shell?
docker exec -it apache-container /bin/bash
Where is Apache’s configuration file located in the container?
/usr/local/apache2/conf/httpd.conf
How can you copy Apache’s configuration file to your host machine?
docker cp apache-container:/usr/local/apache2/conf/httpd.conf .
What is the DocumentRoot directive in Apache?
It defines the directory from which Apache serves files.
What is HTTPS?
HTTPS is a secure version of HTTP using TLS to encrypt communication between client and server.
What does TLS stand for?
Transport Layer Security.
Why is TLS used in web hosting?
To secure communication by encrypting data between client and server.
What is required to set up TLS?
A valid certificate and private key.
What is a self-signed certificate?
A certificate created and signed by the user instead of a Certificate Authority, used for testing.
How do you generate a self-signed certificate using OpenSSL?
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -out selfsigned.crt -keyout private.key -subj “/C=UK/ST=Merseyside/L=Liverpool/O=MyOrg/CN=www.example.com”
What does the -x509 flag do in OpenSSL?
It specifies that a self-signed certificate should be created.
What does the -nodes flag do in OpenSSL?
It tells OpenSSL not to encrypt the private key.
What does -newkey rsa:2048 do in OpenSSL?
It generates a new 2048-bit RSA private key.
What is httpd-ssl.conf?
A custom Apache configuration file used to enable SSL on port 443.