Хочется внедрить докер к текущему проекту и нужно видоизменить их под docker. У меня возникает ошибка при перезагрузки nginx
[warn] conflicting server name "lk.project.local" on 0.0.0.0:80, ignored
Структура проекта
frontend
- web
- index.php
docker
- nginx
- api.project.local.conf
- lk.project.local.conf
- php8.1-fpm
- Dockerfile
- php.ini
docker-compose.yml
Dockerfile
FROM php:8.1-fpm
RUN apt-get update
RUN apt-get install -y curl git zip
RUN docker-php-ext-install pdo pdo_mysql
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN usermod -u 1000 www-data && groupmod -g 1000 www-data
USER "1000:1000"
WORKDIR /var/www
ENTRYPOINT [ "php-fpm" ]
docker-compose.yml
version: '3.2'
networks:
project:
services:
nginx:
container_name: project_nginx
image: nginx:1.18.0
ports:
- 80:80
volumes:
- ./:/var/wwww/project
- ./docker/nginx/api.project.local:/etc/nginx/conf.d/api.project.local.conf
- ./docker/nginx/lk.project.local:/etc/nginx/conf.d/lk.project.local.conf
networks:
- project
depends_on:
- php
php:
container_name: project_php
build: /docker/php8.1-fpm
volumes:
- ./:/var/wwww/project
- ./docker/php.ini:/usr/local/etc/php/conf.d/php.ini
networks:
- project
depends_on:
- db
db:
container_name: project_db
command: ["--default-authentication-plugin=mysql_native_password"]
restart: always
image: mariadb:10.1
environment:
MYSQL_ROOT_PASSWORD: myUserPass
MYSQL_DATABASE: project
MYSQL_USER: myUser
MYSQL_PASSWORD: myUser
networks:
- project
adminer:
image: adminer
container_name: project_adminer
restart: always
depends_on:
- db
ports:
- 8088:8080
и nginx возьму на примере lk.project.local.conf
server {
listen 80;
server_name lk.project.local;
proxy_connect_timeout 3000;
proxy_send_timeout 3000;
proxy_read_timeout 3000;
client_max_body_size 128m;
send_timeout 300;
set $path "/var/www/project/frontend/web";
root $path;
charset utf-8;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_min_length 1024;
gzip_buffers 12 32k;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain application/xhtml+xml text/xml application/xml application/xml+rss text/css application/javascript;
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
expires 1d;
add_header Cache-Control "max-age=86400, public";
}
location / {
root $path;
index index.php index.html;
try_files $uri $uri/ /index.php?$args;
}
location ~* \.php$ {
fastcgi_param SERVER_NAME $host;
root $path;
fastcgi_pass project_php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $path$fastcgi_script_name;
include fastcgi_params;
fastcgi_send_timeout 3000;
fastcgi_read_timeout 3000;
}
}
server {
if ($host = api.project.local) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name "~^www\.(.*)$" ;
return 301 $scheme://$1$request_uri;
listen 80;
server_name api.project.local ;
return 404; # managed by Certbot
}
Не пойму в чем дело с конфигами и как правильно переписать конфиг для docker