Уже голову сломал не могу понять в чем причина.
Есть основной домен api.domain.test, тот что указывется в APP_URL отрабатывает без ошибок..
Другие субдомены cabinet.domain.test, admin.domain.test отдают: 404. Причем 404 отдает сам nginx а не Laravel
docker logs backend.fpm:
172.20.0.6 - 17/Dec/2023:11:26:38 +0000 "GET /index.php" 200 // api.domain.test
172.20.0.6 - 17/Dec/2023:11:26:41 +0000 "GET /index.php" 404 // cabinet.domain.test
172.20.0.6 - 17/Dec/2023:11:26:42 +0000 "GET /index.php" 404 // admin.domain.test
docker logs backend.web:
172.18.0.2 - - [17/Dec/2023:11:26:38 +0000] "GET / HTTP/1.1" 200 44 "-" // api.domain.test
172.18.0.2 - - [17/Dec/2023:11:26:42 +0000] "GET / HTTP/1.1" 404 555 "-" // cabinet.domain.test
172.18.0.2 - - [17/Dec/2023:11:26:44 +0000] "GET / HTTP/1.1" 404 555 "-" // admin.domain.test
docker exec -it backend.fpm php artisan route:list:
GET|HEAD cabinet.domain.test/ ...................................................cabinet.index
GET|HEAD admin.domain.test/..................................................... platform.index
docker-compose.yml:
version: '3.7'
services:
nginx-proxy:
container_name: proxy
image: nginxproxy/nginx-proxy
ports:
- "80:80"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- reverse-proxy
frontend:
container_name: frontend
image: nuxt3
expose:
- 80
environment:
API_URL: http://api.domain.test
API_REFERRER: http://new.domain.test
VIRTUAL_HOST: new.domain.test
VIRTUAL_PORT: 80
NITRO_PORT: 80
PORT: 80
networks:
- backend
- reverse-proxy
backend.web:
build:
context: ${BACKEND_SRC_DIR}
target: fpm_server
container_name: backend.web
expose:
- 80
restart: always
environment:
FPM_HOST: "backend.fpm:9000"
VIRTUAL_HOST: api.domain.test,cabinet.domain.test,admin.domain.test
VIRTUAL_PORT: 80
PORT: 80
networks:
- backend
- reverse-proxy
depends_on:
- "backend.fpm"
backend.fpm:
context: ${BACKEND_SRC_DIR}
target: fpm_server
container_name: backend.fpm
environment:
APP_NAME: "Laravel"
APP_DEBUG: "true"
APP_URL: http://api.domain.test
APP_DOMAIN: api.domain.test
CABINET_DOMAIN: cabinet.domain.test
DASHBOARD_DOMAIN: admin.domain.test
restart: always
networks:
- backend
nginx.conf.template:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /opt/apps/app-source/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.php;
server_name _;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_pass ${FPM_HOST};
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Dockerfile:
FROM php:8.2.6-fpm-alpine as fpm_server
ARG PHP_EXTS
ARG PHP_PECL_EXTS
ARG PHP_EXT_DEPS
ARG PHP_EXT_CONF
WORKDIR /opt/apps/app-source
RUN apk add --no-cache ${PHP_EXT_DEPS}
RUN apk add --virtual build-dependencies --no-cache ${PHPIZE_DEPS} ${PHP_EXT_DEPS} openssl ca-certificates libxml2-dev oniguruma-dev \
&& docker-php-ext-configure ${PHP_EXT_CONF} \
&& docker-php-ext-install -j$(nproc) ${PHP_EXTS} \
&& pecl install ${PHP_PECL_EXTS} \
&& docker-php-ext-enable ${PHP_PECL_EXTS} ${PHP_EXT_ENABLE} \
&& apk del build-dependencies
USER www-data
COPY --from=composer_base --chown=www-data /opt/apps/app-source /opt/apps/app-source
COPY --from=frontend --chown=www-data /opt/apps/app-source/public /opt/apps/app-source/public
RUN php artisan event:cache && \
php artisan route:cache && \
php artisan view:cache
FROM nginx:1.20-alpine as web_server
WORKDIR /opt/apps/app-source
COPY docker/nginx.conf.template /etc/nginx/templates/default.conf.template
COPY --from=frontend /opt/apps/app-source/public /opt/apps/app-source/public