Code Monkey home page Code Monkey logo

ft_server's Introduction

ft_server - @42born2code

Table of Contents:

  1. What is ft_server โ”
  2. Instructions ๐Ÿ‘ˆ
  3. Guide: What I did step by step โœ”๏ธ
  4. How it looks ๐Ÿ’ป
  5. Resources / Research ๐Ÿ”

What is ft_server โ”

SUBJECT

The goal of ft_server is to create a web server with Nginx capable of running a WordPress website, phpMyAdmin, and a MySQL database. This server will run in only one Docker container, under Debian Buster.

Services Path
WordPress http:localhost/wordpress
phpMyAdmin http:localhost/phpmyadmin

final_version

Description for newbies: ๐Ÿ’ก

When you type in the search bar "Google.com" a web server stores the files constituting the website (images, etc.). To obtain the page, your browser makes a request for a web page to the server which then sends the files (if the server doesn't find the requested document, it returns a 404 response instead).

There are different types of web servers: static or dynamic. In our case, we will create a dynamic web server.

From a software point of view, the components of a dynamic web server are:

  • An OS (ex: Windows or Linux)
  • An HTTP server = software that supports client-server requests for the HTTP protocol (ex: Apache or Nginx)
  • A database (ex: mySQL, Oracle)
  • A script language = allows to interpret customer requests and translate them into html (ex: PHP, Python, Java)

  • Our OS = Debian Buster
  • Our HTTP server = Nginx
  • Our Database = Maria DB.
  • Our scripting language = PHP.

Plus we will install and configure phpMyAdmin and WordPress

We are going to do all of this in a Docker container. Why in a Docker container? ๐Ÿณ

โš ๏ธ The problem: Often we end up with applications that have tons of dependencies: need magic to convert images, need a particular database, need nginx or apache etc. When working with a third-party web host it is a bit hell. The system administrator will have to install the correct versions on a number of machines etc., puzzle. ๐Ÿ’ข

๐Ÿ’ฏ The solution: Docker makes it possible to package an application in a virtual container. It's a sort of box that is completely isolated from our operating system. In which we can install all the libraries that our application needs to function. And we also install our application there. And so we can send this box all over the place, and it's going to work no matter what operating system.โœ”๏ธ

The Docker image would include:

  • Nginx
  • PHP
  • MariaDB SQL database
  • PhpMyAdmin
  • Wordpress

Instructions ๐Ÿ‘ˆ

๐Ÿ”ง Installation

git clone https://github.com/vvarodi/ft_server.git && cd ft_server

๐Ÿ“ฆ Content

  • Dockerfile (contains the instructions for building the webserver's docker image)

  • srcs/ (contains configs and some bash scripts)

  • testing.sh (Build, run and enter a container)

  • deleting.sh (Remove and clean)

autoindex_on/off.sh (Once the container is running, stop and change AUTOINDEX environment variable)

๐Ÿ”จ Build Docker image

docker build -t ft_server .

๐Ÿƒ Run a container

docker run --name ft_server -d -p 443:443 -p 80:80 ft_server

๐Ÿš Shell acces to the container

docker exec -it ft_server bash

๐Ÿ“ Autoindex on/off

By default AUTOINDEX is on when you run the container. If you want to run the container setting autoindex off at the beggining of being launched:

docker run --env AUTOINDEX=off --name ft_server -d -p 443:443 -p 80:80 ft_server

It also can be activated/desactivated when the container is launched (via an environment variable):

Inside the container

echo $AUTOINDEX
AUTOINDEX=off
bash change_autoindex.sh

or outside the container

sh autoindex_off.sh

Guide: What I did step by step

Wiki

How it looks ๐Ÿ‘€

http://localhost/

final

http://localhost/pypmyadmin

phpmyadmin

http://localhost/wordpress

WordPressWelcome

Resources/Research: ๐Ÿ”

ft_server's People

Contributors

vvarodi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.