How to Host Wordpress Using Docker

Let’s the docker compose file first.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
version: '3'

services:
  wp:
    image: wordpress:latest
    ports:
      - ${IP}:80:80
    volumes:
      - ./php.conf.ini:/usr/local/etc/php/conf.d/conf.ini
      - ./wordpress:/var/www/html
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_NAME: "${DB_NAME}"
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: "${DB_ROOT_PASSWORD}"
    depends_on:
      - db

  pma:
    image: phpmyadmin/phpmyadmin
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"
    ports:
      - ${IP}:8080:80
    links:
      - db:db

  db:
    image: mysql:latest
    ports:
      - ${IP}:3306:3306
    command: [
        '--default_authentication_plugin=mysql_native_password',
        '--character-set-server=utf8mb4',
        '--collation-server=utf8mb4_unicode_ci'
    ]
    volumes:
      - ./wp-data:/docker-entrypoint-initdb.d
      - db_data:/var/lib/mysql
    environment:
      MYSQL_DATABASE: "${DB_NAME}"
      MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"

volumes:
  db_data:

Here comes a relavant php.conf.ini file:

How to Auto Start OpenVPN Client on Ubuntu Bionic

Launch OpenVPN client as a daemon.

Here I assume you already have your own cert file: filename.ovpn. πŸ™‚

Modify its file extension to a conf file like so:

1
mv filename.ovpn filename.conf

Move the file inside /etc/openvpn directory like so:

1
mv /path/to/filename.conf /etc/openvpn/

OpenVPN client service name would be openvpn@filename.

Well, you might already know what to do to launch the service.

Basic Docker Notes

Create and run a new container from an image

1
docker container run -it --rm ubuntu /bin/bash
  • -i or --interactive: Keep STDIN open even if not attached
  • -t or --tty: Allocate a pseudo-TTY
  • --rm: Automatically remove the container when it exits
  • --name: Assign a name to the container
  • -d or --detach: Run container in background and print container ID

Aliases: docker container run, docker run

List containers

1
docker container ps -a
  • -a or --all: Show all containers (default shows just running)

Aliases: docker container ls, docker container list, docker container ps, docker ps

How to Setup LAMP Stack on Centos 7 - Right Way

This post shows how to setup a standard LAMP stack on CentOS 7.

For the latest version of phpMyAdmin:

1
2
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install epel-release

For MariaDB:

1
2
3
yum -y install mariadb-server mariadb
systemctl enable --now mariadb
mysql_secure_installation

For Apache:

1
2
yum -y install httpd
systemctl enable --now httpd

For PHP:

How to Setup a Reverse Proxy with Nginx on Centos 7

Firstly, install nginx on the server.

1
2
3
yum update
yum install epel-release
yum install nginx

Edit the nginx config file then.

1
2
cd /etc/nginx/nginx.conf
vim nginx.conf

Edit the file like this:

1
server_name domain.com;

If you are not going to use a domain name, a public ip address would also work instead of domain.com πŸ™‚ Find the location section in the file and replace it with: