app on base domain, api (drupal) on subpath /api

This commit is contained in:
2021-02-08 17:07:55 +01:00
parent f2e5d7ec7e
commit 718662c56e
12 changed files with 94 additions and 41 deletions
+4
View File
@@ -1,5 +1,9 @@
FROM nginx:latest FROM nginx:latest
RUN apt-get update \
&& apt-get install -y \
vim
COPY ./default.conf /etc/nginx/conf.d/default.conf COPY ./default.conf /etc/nginx/conf.d/default.conf
COPY ./bashrc /root/.bashrc COPY ./bashrc /root/.bashrc
COPY ./inputrc /root/.inputrc COPY ./inputrc /root/.inputrc
+56 -14
View File
@@ -1,36 +1,78 @@
upstream app{
server app:8988;
}
server { server {
listen 80 default_server; listen 80 default_server;
root /var/www/html/api/src/web; # root /var/www/html/api/src/web;
# root /var/www/html/app/dist;
index index.html index.php; index index.html index.php;
server_name *.enfrancais.fr; server_name *.enfrancais.fr;
charset utf-8; charset utf-8;
location / { location / {
try_files $uri $uri/ /index.php?$query_string; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Ssl on;
proxy_pass http://app;
proxy_redirect off;
}
# https://serversforhackers.com/c/nginx-php-in-subdirectory
location @api {
rewrite ^/api/(.*)$ /api/index.php;
}
location /api {
# rewrite /api/(.*)$ /$1 break;
# root /var/www/html/api/src/web;
alias /var/www/html/api/src/web/;
# index index.php;
# try_files $uri $uri/ /index.php?$query_string;
try_files $uri $uri/ @api;
error_log /var/log/nginx/api-error.log debug;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass api:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_read_timeout 150;
}
} }
location = /favicon.ico { access_log off; log_not_found off; } location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; }
access_log on; access_log on;
error_log /var/log/nginx/error.log error; error_log /var/log/nginx/app-error.log error;
sendfile off; sendfile off;
client_max_body_size 100m; client_max_body_size 100m;
location ~ \.php$ { # location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$; # fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000; # fastcgi_pass api:9000;
fastcgi_index index.php; # fastcgi_index index.php;
include fastcgi_params; # include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off; # fastcgi_intercept_errors off;
fastcgi_buffer_size 16k; # fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k; # fastcgi_buffers 4 16k;
fastcgi_read_timeout 150; # fastcgi_read_timeout 150;
} # }
location ~ /\.ht { location ~ /\.ht {
deny all; deny all;
+4 -2
View File
@@ -21,6 +21,8 @@ build:
buildnc: buildnc:
docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME) docker-compose build --no-cache --build-arg USER_UID=$(USER_UID) --build-arg USER_UNAME=$(USER_UNAME) --build-arg USER_GID=$(USER_GID) --build-arg USER_GNAME=$(USER_GNAME)
downbuildup: down build up
up: up:
docker-compose up -d docker-compose up -d
@@ -36,8 +38,8 @@ logs:
down: down:
docker-compose down docker-compose down
exec_php: exec_api:
docker exec -it enfrancais_php_1 bash docker exec -it enfrancais_api_1 bash
exec_app: exec_app:
docker exec -it enfrancais_app_1 sh docker exec -it enfrancais_app_1 sh
+1 -1
Submodule api updated: f0966cea3f...4459a24dad
+29 -24
View File
@@ -27,8 +27,19 @@ services:
ports: ports:
- "6389" - "6389"
php: phpmyadmin:
build: ./Docker/php/ image: phpmyadmin/phpmyadmin
ports:
- 8991:80
networks:
- database
depends_on:
- mysql
environment:
PMA_HOSTS: mysql,mysql-legacy
api:
build: ./Docker/api/
expose: expose:
- 9000 - 9000
user: ${USER_UID}:${USER_GID} user: ${USER_UID}:${USER_GID}
@@ -45,16 +56,20 @@ services:
- mysql - mysql
- redis - redis
phpmyadmin: app:
image: phpmyadmin/phpmyadmin build: ./Docker/app
ports: user: ${USER_UID}:${USER_GID}
- 8991:80 volumes:
- "${APP_ROOT}:/app"
- npm-user-data:/home/${USER_UNAME}
networks: networks:
- database - app
depends_on: - server
- mysql ports:
- 8988:8988
working_dir: "/app"
environment: environment:
PMA_HOSTS: mysql,mysql-legacy - APP_ENV=dev
nginx: nginx:
build: ./Docker/nginx/ build: ./Docker/nginx/
@@ -68,20 +83,9 @@ services:
networks: networks:
- server - server
depends_on: depends_on:
- php - api
- app
app: # command: [nginx-debug, '-g', 'daemon off;']
build: ./Docker/app
user: ${USER_UID}:${USER_GID}
volumes:
- "${APP_ROOT}:/app"
- npm-user-data:/home/${USER_UNAME}
ports:
- 8988:8988
working_dir: "/app"
environment:
- APP_ENV=dev
volumes: volumes:
php-user-data: php-user-data:
@@ -93,3 +97,4 @@ networks:
database: database:
redis: redis:
server: server:
app: