App service
Services/Apache HTTP server

Apache HTTP server service

Apache HTTP Server service for serving web content, with editable server and virtual host configuration.

This service runs your code: its image is built from a Git repository, and each build is deployed to an app environment.

On Wodby

How Apache HTTP server runs on Wodby

What Wodby sets up for this web server. Apache here is configured by environment variables, by the config files the service declares and by the application's own .htaccess files.

How it is configured

On every start the container renders its configuration from templates and environment variables: conf/httpd.conf, conf/conf.d/vhost.conf (one virtual host) and conf/preset.conf under /usr/local/apache2. They are rewritten on each start; never edit them in a running container.

To change the configuration:

  • Set APACHE_* environment variables on the service.
  • Change the docroot setting.
  • Override the main configuration template or the virtual host template, both declared as config files of this service.
  • Add .htaccess files to the codebase: overrides are allowed in the document root (APACHE_ALLOW_OVERRIDE_ENABLED), and mod_rewrite, mod_headers, mod_expires and mod_deflate are loaded.

Preset

APACHE_VHOST_PRESET selects the rules included in the virtual host. This service uses the image default, html: files are served from the document root with index.html as the directory index (APACHE_DIRECTORY_INDEX). There is no fallback for paths that match no file; a single-page application needs its own rewrite rule in .htaccess. The image also ships a php preset, used by the PHP service built on this one.

Document root

The codebase is at /var/www/html. The docroot setting (variable DOCROOT_SUBDIR) names a subdirectory of the repository, and APACHE_DOCUMENT_ROOT is set to /var/www/html/ followed by it. Leave the setting empty to serve the repository root.

Always present

  • /.healthz returns 204 and is not logged. Use it for health checks.
  • Files and directories whose names start with a dot are denied, as are files ending in .sh, .sql, .mysql, .po, .tpl, .make or .test, wodby.yml and Makefile.
  • Directory listings are off unless APACHE_INDEXES_ENABLED is set.

Variables that matter most

VariableEffect
APACHE_DIRECTORY_INDEXdirectory index file
APACHE_ALLOW_OVERRIDE_ENABLEDwhat .htaccess files may override
APACHE_TIMEOUT, APACHE_REQUEST_READ_TIMEOUTrequest time limits
APACHE_LIMITED_ACCESSremoves the rule that grants access to everyone, so that access is defined elsewhere
APACHE_HTTP2accepts cleartext HTTP/2
APACHE_INCLUDE_CONFthe files included in place of the generated virtual host
APACHE_LOG_LEVELerror log level

Access and error logs go to the container's standard output and error.

Build and reaching the service

  • The image is built from the connected repository: the codebase is copied into the image at /var/www/html. Files are served from the built image, so a change needs a new build and deployment.
  • Other services reach it over HTTP on port 80 at the app service's name inside the environment.

Check the result

  • httpd -S prints the virtual host in effect; httpd -t checks the syntax.
  • curl -sI localhost/.healthz returns 204 from inside the container.

Overview

Technical profile of Apache HTTP server

The versions are the ones you can select for Apache HTTP server in a stack or an app environment. The service itself is published in revisions, and a stack references a specific revision.

Service type

App service

Versions

2.4

Stacks

Stacks that include Apache HTTP server

This public stack includes Apache HTTP server. You can create an app from a public stack as it is, or add the service to a stack of your own.

CI/CD

Build Apache HTTP server from a Git repository

Start from a public boilerplate or connect your own repository. With Wodby CI, a push to the branch that an app environment follows starts a build of Apache HTTP server, and the pipeline deploys it.

Git providers

You connect a repository through an integration with its Git provider.

CI providers

Wodby CI is built in: the pipeline is the file .wodby/pipeline.yml in the repository. For a repository you connect, an external CI provider can run the same steps with Wodby CLI.

Container registries

Built images go to Wodby Registry by default, or to an external registry that you connect as an integration.

Environment variables from integrations

A variable integration stores the credentials of a third-party service once. Attach it to Apache HTTP server and Wodby passes them to the container as environment variables at runtime, not during the image build.

Configuration

Apache HTTP server service configuration

The Apache HTTP server service declares the following. Where a value can be changed, a stack sets it and each app environment can override it.

Technical domains

Wodby gives each public HTTP port a technical domain with a TLS certificate and renews the certificate. A port that the service marks private gets no domain. You can add custom domains.

Configs

2 config files that a stack or an app environment can override.

Settings

1 setting that a stack or an app environment can change.

Based on this service

Services based on Apache HTTP server

This catalog service inherits the configuration of Apache HTTP server and changes parts of it. A service of your own can inherit from it the same way.