Skip to content
vvarodi edited this page Sep 6, 2020 · 1 revision

Welcome to the ft_server wiki!

Guide: What I did step by step

Learn Docker basics command

# Build a docker image from a Dockerfile
docker build -t <your image name> <your Dockerfile dir>

# Start an instance of a docker image
docker run -it <your image name>

# Really important if you want to bind some ports on the container to your own computer, use -p option.
# Example for an Apache image first 80 means is local port, second 80 means container port
docker run -it debian:apache -p 80:80

# Enter running container
docker exec -it <ID or container name> bash

# See all images
docker images

# Remove images
docker rmi <image>
# docker rmi $(docker images -aq)

# Remove a container
$ docker rm <ID or container name>

# See running containers
docker ps
# List all docker containers (running and stopped).
docker ps -a

# Stop a container
docker kill <ID or container name>

# Delete all unused Docker images and cache and free space
docker system prune

Guide

Step 1: Nginx installed to serve your content.

Succesfully-installed-nginx

/etc/nginx/sites-available/* Extra virtual host configuration files
/etc/nginx/sites-enabled/* Symlink to sites-available/<file> to enable vhost

SimpleHello

Step 2: Installed PHP for Processing && Configuring Nginx to Use the PHP Processor

php-info

php-working

Step 3: MySQL installed to store and manage your data.

MariaDB (database system) installed to store and manage data for your site, some Linux distributions (including Debian) use MariaDB as a drop-in replacement for MySQL Installation --> code

+--------------------+
f Database           f
+--------------------+
f information_schema f
f mysql              f
f new_database       f
f performance_schema f
+--------------------+
4 rows in set (0.000 sec)

Step 4: phpMyAdmin installed to handle the administration of MySQL over the Web.

phpMyAdmin

Checking connection between MySQL and phpMyAdmin: Testing Database Connection from PHP code

phpMyAdmin1

phpMyAdmin2

Step 5: WordPress. Installation and Connection to wordpress database

WordPressWelcome

WordPressBlog

Checking connection between MySQL/phpMyAdmin with WordPress: wordpress database

WordPressDataBase

Exporting database and Connecting my database to wordpress. This way I see the page when going to http://localhost/wordpress and not wordpress config

http://localhost/wordpress/wp-admin to modify

(Not at final version) Commit

Hola_mundo

Autoindex

  • Autoindex-error
  • autoindex off-error 403 "Without autoindex option you should be getting Error 403 for requests that end with / on directories that do not have an index.html file. With autoindex on you should be getting a simple listing"

Autoindex ON

ON

Autoindex OFF

By ARG: Commit

docker build -t ft_server . --build-arg autoindex=off

By ENV:

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

OFF server_tokens off; Config to not show nginx version OFF2 Verifying if the server is running with an autoindex which can be desactivated when the container is launched (via an environment variable)

change_autoindex

Handle errors:

If your page is not loading or throwing an error. Inspect:

cat /var/log/nginx/access.log
cat /var/log/nginx/error.log

To see all running services:

service --status-all 

services

How it looks 👀

http://localhost/

final

http://localhost/pypmyadmin

phpmyadmin

http://localhost/wordpress

WordPressWelcome