Handling of service specific nginx config

master
Florian Meissner, DL1MRV 2023-07-13 11:52:27 +02:00
parent 23bd1c26e3
commit 70a170af35
4 changed files with 65 additions and 20 deletions

@ -1 +1 @@
Subproject commit d2e502712acac5c1f50bfe94fc60d2595f2a6a61 Subproject commit 453ecef4e8e015de60bf4dfc707a264ef91895bc

View File

@ -30,50 +30,52 @@ version: '3.8'
services: services:
nginx: backend-nginx:
container_name: adb-nginx container_name: european-airports_api-nginx
build: build:
context: ./nginx context: ./nginx
args: args:
NGINX_VERSION: ${NGINX_VERSION} NGINX_VERSION: ${NGINX_VERSION}
image: fm/adb-nginx image: european-airports/api-nginx
restart: always restart: always
ports: ports:
- 8080:80 - 8080:80
depends_on: depends_on:
- php - backend-php
env_file: ./nginx/nginx.env env_file:
- ./nginx/nginx.env
- ./backend/nginx.env
volumes: volumes:
- ./src/:/var/www/html - ./backend/src/:/var/www/html
networks: networks:
- backend - backend
- web - web
php: backend-php:
container_name: adb-php container_name: european-airports_api-php
build: build:
context: ./php-fpm context: ./php-fpm
args: args:
PHP_VERSION: ${PHP_VERSION} PHP_VERSION: ${PHP_VERSION}
image: fm/adb-php-fpm image: european-airports/api-php-fpm
restart: always restart: always
env_file: ./php-fpm/php.env env_file: ./php-fpm/php.env
volumes: volumes:
- ./src/:/var/www/html - ./backend/src/:/var/www/html
networks: networks:
- backend - backend
secrets: # secrets:
- vereinsflieger # -
networks: networks:
backend: backend:
driver: bridge driver: bridge
name: "adb-backend" name: "european-airports/backend"
web: web:
driver: bridge driver: bridge
name: "adb-web" name: "european-airports/web"
secrets: # secrets:
vereinsflieger: # vereinsflieger:
file: ./secrets/vereinsflieger.txt # file: ./secrets/vereinsflieger.txt

View File

@ -0,0 +1,43 @@
****************************************************************************************************
* ______ _ _ *
* | ____| /\ (_) | | *
* | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
* | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
* | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
* |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
* | | | | *
* |_| |_| *
* *
****************************************************************************************************
This file is part of the European Airports Project, a free, collaborative platform of airport data
extending beyond the official AIPs.
Copyright (C) 2023
Florian Meissner <florianmeissner@gmx.de>
This program is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software Foundation, either
version 3 of the License, or (at your option) any later version. This program is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along with this program.
(license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
# Description of templates
This folder contains configuration templates for nginx to tailor it to the needs of specific
services. The idea behind it is, that one nginx image can be used for multiple service containers.
Each file ending with *.template should be a valid nginx configration file. The difference is that
it may contain environment variables in the form of `${VAR_NAME}`. These variables will be
substituted by docker environment variables and a regular nginx config file will be placed under
`/etc/nginx/conf.d` with the same name as the template except for the `*.template` extension.
# Further reading
- [Nginx docker Readme](https://github.com/docker-library/docs/tree/master/nginx#using-environment-
variables-in-nginx-configuration-new-in-119)
- [Explaining post from ServerFault](https://serverfault.com/a/755541)

View File

@ -29,12 +29,12 @@
server { server {
listen 80; listen 80;
root /var/www/html; root /var/www/html;
server_name adb.european-airports.org; server_name ${NGINX_HOST}
index index.php; index index.php;
location ~ \.php$ { location ~ \.php$ {
include fastcgi_params; include fastcgi_params;
fastcgi_pass php:9000; fastcgi_pass ${PHP_HOST}:9000;
fastcgi_index index.php; fastcgi_index index.php;
fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;