Skip to content

Instantly share code, notes, and snippets.

@Jarvvski
Created July 3, 2021 22:02
Show Gist options
  • Select an option

  • Save Jarvvski/0c38dd6c113d4ecfd24dfd21142b2f35 to your computer and use it in GitHub Desktop.

Select an option

Save Jarvvski/0c38dd6c113d4ecfd24dfd21142b2f35 to your computer and use it in GitHub Desktop.
Trimmed docker compose for deploying xenforo
server {
listen 80;
index index.php index.html;
root /var/www/html;
real_ip_header X-Forwarded-For;
set_real_ip_from 172.17.0.0/16;
location / {
try_files $uri $uri/ /index.php?$uri&$args;
}
location ~ \.php$ {
# try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass xenforo:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
version: '3.7'
services:
xenforo_server:
image: jarvvski/xenforo-2-php-fpm:alpine
container_name: xenforo
healthcheck:
test: ["CMD", "php-fpm-healthcheck"]
interval: 15s
timeout: 10s
retries: 3
start_period: 1m
networks:
- xenforo
restart: always
working_dir: /var/www/html
volumes:
- xenforo-data:/var/www/html:rw
environment:
DB_PORT: 3306
DB_HOST: xenforo-db
DB_USER: xenforo
DB_PASSWORD: <db-password>
DB_NAME: xenforo
nginx:
image: nginx:1.19-alpine
container_name: xenforo-nginx
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 15s
timeout: 10s
retries: 3
start_period: 1m
restart: always
ports:
- 80:80
networks:
- xenforo
volumes_from:
- xenforo_server:rw
volumes:
- xenforo-nginx-conf:/etc/nginx/conf.d/
database:
container_name: xenforo-db
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "$$MYSQL_USER", "--password=$$MYSQL_PASSWORD"]
interval: 15s
timeout: 10s
retries: 3
start_period: 1m
restart: always
networks:
- xenforo
image: mariadb:10.3
volumes:
- xenforo-database:/var/lib/mysql
environment:
MYSQL_DATABASE: xenforo
MYSQL_USER: xenforo
MYSQL_PASSWORD: <db-password>
MYSQL_ROOT_PASSWORD: <db-root-password>
volumes:
xenforo-database:
xenforo-data:
driver_opts:
type: none
o: bind
device: /opt/xenforo/
xenforo-nginx-conf:
driver_opts:
type: none
o: bind
device: /opt/compose/xenforo/docker/nginx/
networks:
xenforo:
name: xenforo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment