raasss/apache-centos-8

By raasss

Updated about 3 years ago

Docker Image for 8

Image

40

Maintained by: raasss

Quick reference

Introduction

FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features (mostly) useful for heavy-loaded sites. (more info)

Quickstart guide

Starting a Apache instance with the latest version is simple via docker-compose. If you don't have docker-compose tool installed, please go here and follow instractions.

Example docker-compose.yml for apache:

version: '3.7'

networks:
  private:
    driver: bridge

services:
  apache:
    image: raasss/apache-centos-8:latest
    networks:
      - private
    ports:
      - "80"
    volumes:
      - type: bind
        source: ./htdocs
        target: /var/www/html
        read_only: true

In your current working directory create docker-compose.yml file. Create also directory htdocs/ and populate it with some .html files. This will be root directory for local website development.

Run docker-compose and services should be up soon:

$ docker-compose up -d

We can find port where apache listen for connections like this:

$ docker-compose port apache 80
0.0.0.0:49154

In this example we can go to web browser and type in url like http://0.0.0.0:49154.

Advance guide

Container shell access

The docker-compose exec command allows you to run commands inside a Docker container.

The following command line will give you a bash shell inside your apache container as root:

$ docker-compose exec apache bash

Access logs

The log is available through Docker's container log:

$ docker-compose logs apache -f

You can omit -f if you don't want to tail logs in realtime.

Customizing via environment variables

As most common usage of Apache is as PHP Fast-CGI proxy, following environment variables are supported.

PHP_FPM_SERVER

Hostname where PHP-FPM listens to. Default value is php-fpm-server.

PHP_FPM_PORT

Port where PHP-FPM listens to. Default value is 9000.

PHP_FPM_PING_URL

URL path where PHP-FPM ping is. Default value is /ping.

PHP_FPM_STATUS_URL

URL path where PHP-FPM status is. Default value is /status.

Docker Pull Command

docker pull raasss/apache-centos-8