{"id":19053287,"url":"https://github.com/jotavare/inception","last_synced_at":"2026-04-11T17:34:43.301Z","repository":{"id":209830922,"uuid":"725046282","full_name":"jotavare/inception","owner":"jotavare","description":"This project aims to broaden my knowledge of system administration by using Docker.","archived":false,"fork":false,"pushed_at":"2024-06-26T23:36:29.000Z","size":1774,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-02T10:45:33.968Z","etag":null,"topics":["containers","docker","docker-compose","docker-image","mariadb","nginx","php","wordpress"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jotavare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-29T10:24:57.000Z","updated_at":"2024-06-26T23:36:32.000Z","dependencies_parsed_at":"2023-12-02T19:31:19.763Z","dependency_job_id":"852a8422-d321-478c-945d-f3e6e1fffa17","html_url":"https://github.com/jotavare/inception","commit_stats":null,"previous_names":["jotavare/inception"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jotavare%2Finception","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jotavare%2Finception/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jotavare%2Finception/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jotavare%2Finception/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jotavare","download_url":"https://codeload.github.com/jotavare/inception/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240109717,"owners_count":19749181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containers","docker","docker-compose","docker-image","mariadb","nginx","php","wordpress"],"created_at":"2024-11-08T23:29:58.753Z","updated_at":"2025-11-11T17:05:17.782Z","avatar_url":"https://github.com/jotavare.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/jotavare/jotavare/blob/main/42/banners/piscine_and_common_core/github_piscine_and_common_core_banner_inception.png\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/status-finished-success?color=%2312bab9\u0026style=flat-square\"/\u003e\n\t\u003cimg src=\"https://img.shields.io/github/languages/top/jotavare/inception?color=%2312bab9\u0026style=flat-square\" /\u003e\n\t\u003cimg src=\"https://img.shields.io/github/last-commit/jotavare/inception?color=%2312bab9\u0026style=flat-square\"/\u003e\n\t\u003ca href='https://www.linkedin.com/in/jotavare' target=\"_blank\"\u003e\u003cimg alt='Linkedin' src='https://img.shields.io/badge/LinkedIn-blue?style=flat-square'/\u003e\u003c/a\u003e\n\t\u003ca href='https://profile.intra.42.fr/users/jotavare' target=\"_blank\"\u003e\u003cimg alt='42' src='https://img.shields.io/badge/Porto-100000?style=flat-square\u0026logo=42\u0026logoColor=white\u0026labelColor=000000\u0026color=000000'/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"#about\"\u003eAbout\u003c/a\u003e •\n\t\u003ca href=\"#download\"\u003eDownload\u003c/a\u003e •\n\t\u003ca href=\"#create-a-new-virtual-machine\"\u003eCreate a New Virtual Machine\u003c/a\u003e •\n\t\u003ca href=\"#install-debian-os\"\u003eInstall Debian OS\u003c/a\u003e •\n\t\u003ca href=\"#install-necessary-software\"\u003eInstall Necessary Software\u003c/a\u003e •\n\t\u003ca href=\"#port-forwarding\"\u003ePort Forwarding\u003c/a\u003e •\n\t\u003ca href=\"#save-the-configuration\"\u003eSave the Configuration\u003c/a\u003e •\n\t\u003ca href=\"#pre-configure-docker\"\u003ePre-Configure Docker\u003c/a\u003e •\n\t\u003ca href=\"#change-domain-and-install-certificates\"\u003eChange Domain and Install Certificates\u003c/a\u003e •\n\t\u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e •\n\t\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n## ABOUT\nThis project is designed to enhance my understanding of system administration by utilising Docker to virtualise multiple images within my virtual machine. The objective is to establish a streamlined infrastructure incorporating WordPress alongside a LEMP Stack (consisting of Nginx, MariaDB, and PHP) using Docker and Docker-Compose while ensuring compliance with predefined guidelines specified in the subject.\n\nIn this README, you'll find a pseudo-step-by-step guide.\n\n## DOWNLOAD\n- [VirtualBox](https://www.virtualbox.org/) `Website`\n- [Debian](https://www.debian.org/) `Website`\n\n## CREATE A NEW VIRTUAL MACHINE\n#### Name and Operating System\n|                |                                     |\n| -------------- | ----------------------------------- |\n| Name           | `inception`                         |\n| Machine Folder | `/home/\u003cintra_user\u003e/VirtualBox VMs` |\n| Type           | `Linux`                             |\n| Version        | `Debian (64-bit)`                   |\n\n#### Memory Size\n- [x] `1024 MB` (4-8 GB RAM) or `4096 MB` (16 GB RAM or above)\n\n#### Hard Disk\n- [ ] Do not add a virtual hard disk\n- [x] Create a virtual hard disk now\n- [ ] Use an existing virtual hard disk file\n\n#### Hard Disk File Type\n- [x] VDI (VirtualBox Disk Image)\n- [ ] VHD (Virtual Hard Disk)\n- [ ] VMDK (Virtual Machine Disk)\n\n#### Storage on Physical Hard Disk\n- [x] Dynamically allocated\n- [ ] Fixed size\n\n#### File Location and Size\n- [x] `/home/jotavare/VirtualBox VMs/Inception/Inception.vdi`\n- [x] `8,00 GB`\n\n#### Choose a Disk File\n- [x] `Settings` \u003e `Storage` \u003e Click on `Empty`\n- [x] Click on disk icon \u003e `Choose a disk file...` \u003e Insert `debian.iso` file\n\n\u003e [!NOTE]\n\u003e If needed, you can add more processor cores to the virtual machine: `Settings` \u003e `System` \u003e `Processor`.\n\n## INSTALL DEBIAN OS\n#### Commands\n|         |         |\n| ------- | ------- |\n| `TAB`   | Move    |\n| `Space` | Select  |\n| `Enter` | Confirm |\n\n#### Debian GNU/Linux Installer Menu (BIOS mode)\n- [ ] `Graphic Install`\n- [x] `Install`\n- [ ] `Advanced Options`\n- [ ] `Accessible Dark Contrast Installer Menu`\n- [ ] `Help`\n- [ ] `Install with Speech Synthesis`\n\n#### Select a Language\n- [x] `English`\n\n#### Select Your Location\n- [x] `Other` \u003e `Europe` \u003e `Portugal`\n\n#### Configure Locales\n- [x] `United States`\n\n#### Configure the Keyboard\n- [x] `American English`\n\n#### Configure the Network\n|             |             |\n| ----------- | ----------- |\n| Hostname    | `inception` |\n| Domain Name | `\u003cempty\u003e`   |\n\n#### Set Up Users and Passwords\n|                                    |                |\n| ---------------------------------- | -------------- |\n| Root Password                      | `\u003cpassword\u003e`   |\n| Full Name for the New User         | `\u003cintra_user\u003e` |\n| Username for Your Account          | `\u003cintra_user\u003e` |\n| Choose a Password for the New User | `\u003cpassword\u003e`   |\n\n#### Configure the Clock\n- [x] `Lisbon`\n- [ ] `Madeira Islands`\n- [ ] `Azores`\n\n#### Partition Method\n- [x] `Guided - Use entire disk`\n- [ ] `Guided - Use entire disk and set up LVM`\n- [ ] `Guided - Use entire disk and set up encrypted LVM`\n- [ ] `Manual`\n\n#### Select Disk to Partition\n- [x] `SCSI3 (0,0,0) (sda) - 8.6 GB ATA VBOX HARDISK`\n\n#### Partition Scheme\n- [x] `All files in one partition (recommended for new users)`\n\n#### Partition Disks\n- [x] `Finish partitioning and write changes to disk`\n- [x] Write the changes to disks? `Yes`\n\n#### Configure the Package Manager\n- [x] Scan extra installation media? `No`\n- [x] `Portugal`\n- [x] `deb.debian.org`\n- [x] HTTP proxy information (blank for none): `\u003cempty\u003e` `Continue`\n\n#### Configure Popularity-Contest\n- [x] Participate in the package usage survey? `No`\n\n#### Software Selection\n- [x] Select only `SSH server`\n\n#### Install the GRUB Boot Loader\n- [x] Install the GRUB boot loader to your primary drive? `Yes`\n\n#### Configuring grub-pc\n- [ ] Enter device manually\n- [x] `/dev/sda (ata-VBOX_HARDISK_VB2e44d73e-45a0c522)`\n\n#### Finish the Installation and Reboot\n- [x] `Continue`\n\n## SAVE THE CONFIGURATION\n#### Create Snapshot\n- Open the VirtualBox;\n- `Left Click` on top of the right icon of your VM;\n- Click on `Snapshots`;\n- Click on `Take`;\n- Write a name for future reference;\n\n#### Save on Cloud\n- Go to the VirtualBox folder and compress the `inception` folder;\n- Also you can use the `Export` function in VirtualBox;\n- Upload to the internet, usually 1-2 GB;\n\n#### Open on a Different PC\n- Find the main folder of VirtualBox virtual machines;\n- Copy and uncompress the files inside the folder;\n- Open VirtualBox and everything should appear correctly;\n\n## INSTALL NECESSARY SOFTWARE\n|                        |                                                                                      |\n| ---------------------- | ------------------------------------------------------------------------------------ |\n| inception login        | `root`                                                                               |\n| Password               | `\u003cinsert_password\u003e`                                                                  |\n| Update repository list | `apt update`                                                                         |\n| Install necessary apps | `apt install -y sudo ufw docker docker-compose make openbox xinit kitty firefox-esr` |\n| Run GUI                | `startx`                                                                             |\n| Test Firefox           | `Right Click` \u003e `Applications` \u003e `Internet` \u003e `Firefox ESR`                          |\n| Test terminal          | `Right Click` \u003e `Applications` \u003e `System` \u003e `kitty`                                  |\n| Close GUI              | `Right Click` \u003e `Exit`                                                               |\n\n\u003e [!TIP]\n\u003e Don't forget to take a snapshot and save it in the cloud.\n\n## PORT FORWARDING\n#### Configure SSH\n|                                           |                                                                |\n| ----------------------------------------- | -------------------------------------------------------------- |\n| Edit sshd_config file                     | `nano /etc/ssh/sshd_config`                                    |\n| Change ssh port to 4242                   | `#Port 22` to `Port 4242`                                      |\n| Enable root login                         | `#PermitRootLogin prohibit-password` to `PermitRootLogin yes`  |\n| Enable password authentication (Optional) | `#PasswordAuthentication yes` to `PasswordAuthentication yes`  |\n| Save and exit sshd_config file            | `Ctrl + X` \u003e `Y` \u003e `Enter`                                     |\n\n#### Restart Services\n|                   |                            |\n| ----------------- | -------------------------- |\n| Restart ssh       | `service ssh restart`      |\n| Restart sshd      | `service sshd restart`     |\n| Check SSH status  | `service ssh status`       |\n\n#### Configure Firewall\n|                          |                                  |\n| ------------------------ | -------------------------------- |\n| Check status             | `ufw status`                     |\n| Enable ufw               | `ufw enable`                     |\n| Open port 4242 (ssh)     | `ufw allow 4242`                 |\n| Open port 80 (http)      | `ufw allow 80`                   |\n| Open port 443 (https)    | `ufw allow 443`                  |\n| Close virtual machine    | `shutdown now`                   |\n\n#### Port Forwarding\n| Name    | Protocol | Host IP     | Host Port    | Guest IP    | Guest Port   |\n| ------- | -------- | ----------- | ------------ | ----------- | ------------ |\n| `ssh`   | `TCP`    | `127.0.0.1` | `4242`       | `10.0.2.15` | `4242`       |\n| `http`  | `TCP`    | `\u003cempty\u003e` | `80`         | `\u003cempty\u003e` | `80`         |\n| `https` | `TCP`    | `\u003cempty\u003e` | `443`        | `\u003cempty\u003e` | `443`        |\n\n#### Login with the OS terminal\n|                                        |                                      |\n| -------------------------------------- | ------------------------------------ |\n| Start VM and login with ssh on host pc | `ssh root@localhost -p 4242`         |\n| Check the ip adress                    | `ip a` or `hostname -I`              |\n| Check for known ssh hosts              | `cat ~/.ssh/known_hosts`             |\n| Display socket information             | `ss -tunlp`                          |\n\n\u003e [!TIP]\n\u003e Don't forget to take a snapshot and save it in the cloud.\n\n## PRE CONFIGURE DOCKER\n#### Sudo Configuration\n|                                            |                                                  |\n| ------------------------------------------ | ------------------------------------------------ |\n| Open sudoers file                          | `nano /etc/sudoers`                              |\n| Under `# User privilege specification`     | Add `\u003cintra_user\u003e ALL=(ALL:ALL) ALL`             |\n| Save and exit                              | `Ctrl + X` \u003e `Y` \u003e `Enter`                       |\n\n#### Add User to Docker Group\n|                                  |                                                  |\n| -------------------------------- | ------------------------------------------------ |\n| Add user to docker group         | `sudo usermod -aG docker \u003cintra_user\u003e`           |\n| Check user groups                | `groups \u003cintra_user\u003e`                            |\n\n#### Test Configuration\n|                                   |                                                                         |\n| --------------------------------- | ----------------------------------------------------------------------- |\n| Switch user                       | `su \u003cintra_user\u003e`                                                       |\n| Go to home directory              | `cd ~/`                                                                 |\n| Download Docker sample            | `git clone https://github.com/codesshaman/simple_docker_nginx_html.git` |\n| Change directory and build Docker | `cd simple_docker_nginx_html/ \u0026\u0026 docker-compose up -d \u0026\u0026 cd ~/`         |\n| Open browser and write in the URL | `172.0.0.1` (NAT) or `\u003cvm_ip_adress\u003e` (Bridged Adapter)                 |\n| Verify website                    | It should display `My html config is work!`                             |\n\n#### Create Project Directories and Files\n|                                  |                                                  |\n| -------------------------------- | ------------------------------------------------ |\n| Create .sh file                  | `nano make_inception.sh`                         |\n| Copy and past the bash code      | *(Paste the provided bash code bellow)*          |\n| Save and exit                    | `Ctrl + X` \u003e `Y` \u003e `Enter`                       |\n| Give permissions to file         | `chmod 777 make_inception.sh`                    |\n| Run .sh file                     | `./make_inception.sh`                            |\n\n\u003e [!WARNING]\n\u003e Change `\u003cintra_user\u003e` to your username. There are three instances. `CTRL + \\` to search and replace.\n```sh\n#!/bin/bash\nmkdir project\nmkdir project/srcs\ntouch project/Makefile\nmkdir project/srcs/requirements\ntouch project/srcs/docker-compose.yml\ntouch project/srcs/.env\necho \"DOMAIN_NAME=\u003cintra_user\u003e.42.fr\" \u003e project/srcs/.env\necho \"CERT_=./requirements/tools/\u003cintra_user\u003e.42.fr.crt\" \u003e\u003e project/srcs/.env\necho \"KEY_=./requirements/tools/\u003cintra_user\u003e.42.fr.key\" \u003e\u003e project/srcs/.env\necho \"DB_NAME=wordpress\" \u003e\u003e project/srcs/.env\necho \"DB_ROOT=rootpass\" \u003e\u003e project/srcs/.env\necho \"DB_USER=wpuser\" \u003e\u003e project/srcs/.env\necho \"DB_PASS=wppass\" \u003e\u003e project/srcs/.env\nmkdir project/srcs/requirements/bonus\nmkdir project/srcs/requirements/mariadb\nmkdir project/srcs/requirements/mariadb/conf\ntouch project/srcs/requirements/mariadb/conf/create_db.sh\nmkdir project/srcs/requirements/mariadb/tools\necho \"\" \u003e project/srcs/requirements/mariadb/tools/.gitkeep\ntouch project/srcs/requirements/mariadb/Dockerfile\ntouch project/srcs/requirements/mariadb/.dockerignore\necho \".git\" \u003e project/srcs/requirements/mariadb/.dockerignore\necho \".env\" \u003e\u003e project/srcs/requirements/mariadb/.dockerignore\nmkdir project/srcs/requirements/nginx\nmkdir project/srcs/requirements/nginx/conf\ntouch project/srcs/requirements/nginx/conf/nginx.conf\nmkdir project/srcs/requirements/nginx/tools\ntouch project/srcs/requirements/nginx/Dockerfile\necho \".git\" \u003e project/srcs/requirements/mariadb/.dockerignore\necho \".env\" \u003e\u003e project/srcs/requirements/mariadb/.dockerignore\nmkdir project/srcs/requirements/tools\nmkdir project/srcs/requirements/wordpress\nmkdir project/srcs/requirements/wordpress/conf\ntouch project/srcs/requirements/wordpress/conf/wp-config-create.sh\nmkdir project/srcs/requirements/wordpress/tools\necho \"\" \u003e project/srcs/requirements/wordpress/tools/.gitkeep\ntouch project/srcs/requirements/wordpress/Dockerfile\ntouch project/srcs/requirements/wordpress/.dockerignore\necho \".git\" \u003e project/srcs/requirements/wordpress/.dockerignore\necho \".env\" \u003e\u003e project/srcs/requirements/wordpress/.dockerignore\n```\n\n\u003e [!TIP]\n\u003e Don't forget to take a snapshot and save it in the cloud.\n\n## CHANGE DOMAIN AND INSTALL CERTIFICATES\n#### Install mkcert\n| Step                                      | Command                                         |\n|-------------------------------------------|-------------------------------------------------|\n| Update list of repositories               | `sudo apt update -y`                            |\n| Install utilities for mkcert              | `sudo apt install -y wget curl libnss3-tools`   |\n| Download mkcert binary                    | *(Copy and paste the command bellow)*           |\n| Rename the binary                         | `mv mkcert-v*-linux-amd64 mkcert`               |\n| Give all permissions                      | `chmod 777 mkcert`                              |\n| Move mkcert to bin directory              | `sudo mv mkcert /usr/local/bin/`                |\n| Check mkcert version                      | `mkcert --version`                              |\n\n```\ncurl -s https://api.github.com/repos/FiloSottile/mkcert/releases/latest| grep browser_download_url  | grep linux-amd64 | cut -d '\"' -f 4 | wget -qi -\n```\n\n#### Change Local Domain\n|                                      |                                                                          |\n| ------------------------------------ | ------------------------------------------------------------------------ |\n| Edit hosts file                      | `sudo nano /etc/hosts`                                                   |\n| NAT configuration                    | Change `127.0.0.1 localhost` to `127.0.0.1 \u003cintra_user\u003e.42.fr localhost` |\n| Bridged Adapter configuration        | Add `\u003cvm_ip_address\u003e \u003cintra_user\u003e.42.fr`                                 |\n| Start Docker                         | `cd ~/simple_docker_nginx_html/ \u0026\u0026 docker-compose up -d \u0026\u0026 cd ~/`        |\n| Start GUI                            | `sudo startx`                                                            |\n| Open Firefox in VM                   | `Right Click` \u003e `Open Firefox`                                           |\n| Type the following URL               | `http://\u003cintra_user\u003e.42.fr`                                              |\n\n#### Create a Certificate\n|                                |                                                        |\n| ------------------------------ | ------------------------------------------------------ |\n| Change directory               | `cd ~/project/srcs/requirements/tools/`                |\n| Obtain certificate             | `mkcert \u003cintra_user\u003e.42.fr`                            |\n| Change extension name          | `mv \u003cintra_user\u003e.42.fr-key.pem \u003cintra_user\u003e.42.fr.key` |\n| Change extension name          | `mv \u003cintra_user\u003e.42.fr.pem \u003cintra_user\u003e.42.fr.crt`     |\n\n#### Reconfigure Docker NGINX File\n|                                |                                                           |\n| ------------------------------ | --------------------------------------------------------- |\n| Edit NGINX configuration       | `nano ~/simple_docker_nginx_html/nginx/conf.d/nginx.conf` |\n| Paste configuration code       | *(Copy and paste the provided configuration code bellow)* |\n\n\u003e [!WARNING]\n\u003e Change `\u003cintra_user\u003e` to your username. There are three instances. `CTRL + \\` to search and replace.\n```bash\nserver {\n    # Listen on port http\n    listen      80;\n    # Listen on port https - ssl\n    listen      443 ssl;\n    # Set the domain we will work on:\n    server_name  \u003cintra_user\u003e.42.fr \u003cintra_user\u003e.42.fr;\n    # Specify the root directory of the project:\n    root    /var/www/public/html;\n    # The next section is commented out for\n    # normal operation with the host machine.\n    # Redirect from http to https:\n    #if ($scheme = 'http') {\n    #    return 301 https://\u003cintra_user\u003e.42.fr$request_uri;\n    #}\n    # Specify the path to the certificate and key:\n    ssl_certificate     /etc/nginx/ssl/\u003cintra_user\u003e.42.fr.crt;\n    ssl_certificate_key /etc/nginx/ssl/\u003cintra_user\u003e.42.fr.key;\n    # Specify supported tls protocols:\n    ssl_protocols            TLSv1.2 TLSv1.3;\n    # Specify caching options and timeouts:\n    ssl_session_timeout 10m;\n    keepalive_timeout 70;\n    # Tell the server which file extension\n    # to look for in our root folder:\n    location / {\n        try_files $uri /index.html;\n    }\n}\n```\n\n#### Reconfigure Docker YML File\n|                                |                                                                      |\n| ------------------------------ | -------------------------------------------------------------------- |\n| Stop Docker                    | `cd ~/simple_docker_nginx_html/ \u0026\u0026 docker-compose down \u0026\u0026 cd ~/`     |\n| Edit Docker YML File           | `cd ~/simple_docker_nginx_html/ \u0026\u0026 nano docker-compose.yml \u0026\u0026 cd ~/` |\n| In the volume section add      | `/home/${USER}/project/srcs/requirements/tools:/etc/nginx/ssl`       |\n| In the ports section add       | `\"443:443\"`                                                          |\n\n#### Run Project Via HTTPS With GUI\n|                                |                                                                   |\n| ------------------------------ | ----------------------------------------------------------------- |\n| Start Docker                   | `cd ~/simple_docker_nginx_html/ \u0026\u0026 docker-compose up -d \u0026\u0026 cd ~/` |\n| Start GUI                      | `sudo startx`                                                     |\n| Open Firefox in VM             | Check the browser for self-signed certificate                     |\n| Type the following URL         | `\u003cintra_user\u003e.42.fr` or `127.0.0.1` or `\u003cvm_ip_adress\u003e`           |\n\n## MAKEFILE\n\n|                                   |                                                                   |\n| --------------------------------- | ----------------------------------------------------------------- |\n| Create Makefile                   | `nano ~/simple_docker_nginx_html/Makefile`                        |\n| Copy and paste the Makefile rules | *(Copy and paste the provided configuration code bellow)*         |\n\n```bash\nname = simple_nginx_html\n\nall:\n        @printf \"Running the configuration ${name}...\\n\"\n        @docker-compose -f ./docker-compose.yml up -d\n\nbuild:\n        @printf \"Assembling the configuration ${name}...\\n\"\n        @docker-compose -f ./docker-compose.yml up -d --build\n\ndown:\n        @printf \"Stopping the configuration ${name}...\\n\"\n        @docker-compose -f ./docker-compose.yml down\n\nre:\n        @printf \"Rebuilding the configuration ${name}...\\n\"\n        @docker-compose -f ./docker-compose.yml up -d --build\n\nclean: down\n        @printf \"Cleaning the configuration ${name}...\\n\"\n        @docker system prune -a\n\nfclean:\n        @printf \"Complete cleanup of all docker configurations...\\n\"\n        @docker stop $$(docker ps -qa)\n        @docker system prune --all --force --volumes\n        @docker network prune --force\n        @docker volume prune --force\n\n.PHONY: all build down re clean clean\n```\n\n## CREATING AN NGINX CONTAINER\n#### Software Used\n|            |                                        |      |\n| ---------- | -------------------------------------- |----- |\n| Nginx      | Proxying Web Server                    | 443  |\n| PHP        | Scripting language for the web         | -    |\n| Php-Fpm    | A set of libraries for the FastCGI API | 9000 |\n| WordPress  | Content Management System              | -    |\n| MariaDB    | Relational Database                    | 3306 |\n\n#### Create a Dockerfile\n|                               |                                                            |\n| ----------------------------- |----------------------------------------------------------- |\n| Go to the folder of our nginx | `cd ~/project/srcs/requirements/nginx/`                    |\n| Create a Dockerfile in it     | `nano Dockerfile`                                          |\n| Copy and paste                | (copy and paste the code below)                            |\n| Check latest alpine version   | Visit [Alpine Linux website](https://www.alpinelinux.org/) |\n\n```bash\nFROM\talpine:3.16\nRUN\tapk update \u0026\u0026 apk upgrade \u0026\u0026 apk add --no-cache nginx\nEXPOSE\t443\nCMD\t[\"nginx\", \"-g\", \"daemon off;\"]\n```\n\n#### Create a Configuration File\n|                                                 |                                                                                   |\n| ----------------------------------------------- | --------------------------------------------------------------------------------- |\n| Create our config file `nginx.conf`             | `nano conf/nginx.conf`                                                            |\n| Copy and paste                                  | *(copy and paste the code below)*                                                 |\n| Copy certificate keys to the nginx tools folder | `cp ~/project/srcs/requirements/tools/* ~/project/srcs/requirements/nginx/tools/` |\n\n```bash\nserver {\n    listen      443 ssl;\n    server_name  \u003cintra_user\u003e.42.fr www.\u003cintra_user\u003e.42.fr;\n    root    /var/www/;\n    index index.php index.html;\n    ssl_certificate     /etc/nginx/ssl/\u003cintra_user\u003e.42.fr.crt;\n    ssl_certificate_key /etc/nginx/ssl/\u003cintra_user\u003e.42.fr.key;\n    ssl_protocols       TLSv1.2 TLSv1.3;\n    ssl_session_timeout 10m;\n    keepalive_timeout 70;\n    location / {\n        try_files $uri /index.php?$args /index.html;\n        add_header Last-Modified $date_gmt;\n        add_header Cache-Control 'no-store, no-cache';\n        if_modified_since off;\n        expires off;\n        etag off;\n    }\n#    location ~ \\.php$ {\n#        fastcgi_split_path_info ^(.+\\.php)(/.+)$;\n#        fastcgi_pass wordpress:9000;\n#        fastcgi_index index.php;\n#        include fastcgi_params;\n#        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n#        fastcgi_param PATH_INFO $fastcgi_path_info;\n#    }\n}\n```\n\n#### Creating a docker-compose Configuration\n|                                 |                                                          |\n| ------------------------------- |--------------------------------------------------------- |\n| Open `docker-compose.yml`       | `cd ../../ \u0026\u0026 nano docker-compose.yml`                   |\n| Copy and paste                  | *(Copy and paste the code below)*                        |\n| Turn off test configuration     | `cd ~/simple_docker_nginx_html/ \u0026\u0026 docker-compose down`  |\n| Launch the new configuration    | `cd ~/project/srcs/ \u0026\u0026 docker-compose up -d`             |\n| Access via HTTPS                | `https://127.0.0.1` in the browser                       |\n|                                 | `https://\u003cintra_user\u003e.42.fr` in the GUI                  |\n\n```bash\nversion: '3'\n\nservices:\n  nginx:\n    build:\n      context: .\n      dockerfile: requirements/nginx/Dockerfile\n    container_name: nginx\n#    depends_on:\n#      - wordpress\n    ports:\n      - \"443:443\"\n    volumes:\n      - ./requirements/nginx/conf/:/etc/nginx/http.d/\n      - ./requirements/nginx/tools:/etc/nginx/ssl/\n      - /home/${USER}/simple_docker_nginx_html/public/html:/var/www/\n    restart: always\n```\n\n## CONTRIBUTING\n\nIf you find any issues or have suggestions for improvements, feel free to fork the repository and open an issue or submit a pull request.\n\n## LICENSE\n\nThis project is available under the MIT License. For further details, please refer to the [LICENSE](https://github.com/jotavare/inception/blob/master/LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjotavare%2Finception","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjotavare%2Finception","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjotavare%2Finception/lists"}