Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 2.22 KB

php-nginx.md

File metadata and controls

42 lines (29 loc) · 2.22 KB

webdevops/php-nginx and webdevops/php-nginx-dev

webdevops/php plus Nginx. Nginx serves /app and passes PHP requests to PHP-FPM in the same container.

Tags

8.2, 8.3, 8.4, 8.5 (Debian 12) and 8.2-alpine, 8.3-alpine, 8.4-alpine, 8.5-alpine, for both php-nginx and php-nginx-dev.

Usage

services:
  app:
    image: webdevops/php-nginx:8.5
    ports:
      - "8080:80"
    environment:
      WEB_DOCUMENT_ROOT: /app/public
    volumes:
      - ./:/app

Ports: 80 (HTTP) and 443 (HTTPS). HTTPS uses a self-signed certificate for *.vm that every build of the image creates anew, valid for ten years. To use your own certificate, see Configuration files. Nginx listens on IPv4 and IPv6; if the container has no IPv6, it listens on IPv4 only. Your own configuration files with listen [::] are not changed, see Configuration files.

Services

Started by default: nginx, php-fpm, cron, syslog. The -dev variant also starts postfix and ssh.

Configuration

  • Web server settings: Web server. WEB_DOCUMENT_ROOT, WEB_DOCUMENT_INDEX, WEB_ALIAS_DOMAIN, WEB_PHP_TIMEOUT and SERVICE_NGINX_CLIENT_MAX_BODY_SIZE apply to Nginx.
  • PHP and PHP-FPM settings: see webdevops/php and Environment variables.
  • Scripts and hooks: Customization. Nginx's hook directory is /opt/docker/bin/service.d/nginx.d.

Development variant (php-nginx-dev)

php-nginx-dev is built on php-nginx and changes the following:

  • Xdebug is loaded by default, as in php-dev; PHP_DEBUGGER switches to Blackfire or turns both off. To connect your IDE, see Xdebug with an IDE.
  • opcache.revalidate_freq is 0.
  • Postfix and an SSH server are started. Postfix sends mail to real recipients unless you set a relay host, see Mail. As in php-dev, root and application have the password dev, also for SSH.
  • Files matching WEB_NO_CACHE_PATTERN (CSS, JavaScript, images, JSON, XML by default) are served with expires off.