Development repo for 42cursus' ft_server project
For further information about 42cursus and its projects, please refer to 42cursus repo.
About · Index · Usage · Useful Links · Study Summary
This is a System Administration subject. You will discover Docker and you will set up your first web server.
For detailed information, refer to the subject of this project.
🚀 TLDR: this project consists of developing a web server set up with Docker. The web server
includes NGINX, SSL Protocol, a MySQL database (MariaDB), phpMyAdmin and Wordpress.
@root
- Dockerfile - contains the instructions for building the web server's docker image.
@/srcs/
- setup.sh - script for setup configuration: installs and configures all requested services.
- services.sh - script for initialization of webserver's services.
- autoindex.sh - script for turning autoindex on or off.
- testing.sh - script (with docker commands) for testing the project.
@/srcs/setup/
- nginx.conf - NGINX's configuration file.
- phpMyAdmin-5.0.2-english.tar.gz - compressed files for phpMyAdmin installation.
- wordpress-5.3.2-pt_BR.tar.gz - compressed files for Wordpress installation.
- config.inc.php - phpMyAdmin's configuration file.
- wp-config.php - Wordpress' configuration file.
- wordpress.sql - Wordpress' SQL database.
1. Check system specification
This project requires Docker to run. To check if you have Docker installed, run:
$ docker --version2. Install requirements
To install Docker, follow the instructions available in the official documentation.
1. Creating the Docker image
To create the Docker image, from the root of this repo run:
$ docker build -t <image_name> .To check if the image was properly created, run:
$ docker images2. Creating a Docker container
To create a Docker container, run:
$ docker run --name <container_name> -it -p 80:80 -p 443:443 <image_name>To list all existing containers, run:
$ docker container ls -al3. Accessing the web server
Open a web browser and navigate to the localhost.
To access the database manager, go to localhost/wordpress/wp-login.php
Docker
- Docker website
- Docker Documentation - Get Started
- Docker Documentation - CLI (commands)
- Dockerfile reference
- Best practices for writing Dockerfiles
- Docker Hub (image repository)
Debian
Webserver Tutorial
NGINX
SSL Protocol
Webserver's services
Docker is a solution for the management of lightweight process containers.
An image is an object that you can download and reuse to instantiate new containers. Ready-made images are provided in Docker's official repositories (their "official images"), the Docker Hub.
Docker can build images automatically by reading the instructions from a Dockerfile - a text file that contains all commands, in order, needed to build a given image. Using docker build users can create an automated build that executes several command-line instructions in succession.
The build is run by the Docker daemon, not by the CLI. Docker daemon is a server which interacts with the operating system and performs all kinds of services.
An ENTRYPOINT identifies which executable should be run when a container is started from your image.
Docker CLI commands:
docker images- List all docker images.docker rmi [image_name]- Remove image.docker build -t [image_name] .- Build an image from a Dockerfile (in current location).docker run --name [container_name] image- Start a container from an image, with a custom name.docker run --name [container_name] -it -p 80:80 -p 443:443 [name]--iinteractive,-pports.docker start|stop [container_name]- Start or stop an existing container.docker ps- List currently running docker containers.docker ps -a- List all docker containers (running and stopped).docker exec -it [container_name] sh- Open a shell inside of an already running container.docker rm [container_name]- Remove a stopped container.
Reference: Docker Documentation - CLI
NGINX (read as "engine-x" ) is a lightweight, high-performance web server designed for high-traffic use cases.
OpenSSL is a software library for applications that secure communications over computer networks against eavesdropping or need to identify the party at the other end.
MySQL is an open-source relational database management system.
MariaDB is a community-developed, commercially supported fork of the MySQL relational database management system, intended to remain free and open-source software under the GNU General Public License.
phpMyAdmin is a free and open source administration tool for MySQL and MariaDB.
WordPress (WP, WordPress.org) is a free and open-source content management system (CMS) written in PHP and paired with a MySQL or MariaDB database.
- Wordpress login page: https://localhost/wordpress/wp-login.php