我正在尝试通过使用Kompose(kompose.io)将docker-compose.yaml部署到kubernetes。我试图通过使用docker-compose up -d nginx mariadb在本地运行它,并且一切正常。我的项目使用Laradock作为开发基础(laradock.io)。当我尝试使用管道(从BitBucket进行部署)时,一切正常,就可以部署,只有一个问题:当我访问主机时,仍然看到:欢迎使用nginx。我正在使用docker-compose。
我的docker-compose.yaml看起来像这样:
version: '3'
networks:
frontend:
driver: bridge
backend:
driver: bridge
volumes:
mariadb:
driver: local
services:
### PHP-FPM ##############################################
php-fpm:
build:
context: ./php-fpm
args:
- LARADOCK_PHP_VERSION=7.2
- INSTALL_XDEBUG=true
- INSTALL_PHPDBG=true
- INSTALL_SOAP=true
- INSTALL_XSL=true
- INSTALL_OPCACHE=true
- INSTALL_MYSQLI=true
- INSTALL_CALENDAR=true
- INSTALL_YAML=true
- INSTALL_ADDITIONAL_LOCALES=true
- INSTALL_MYSQL_CLIENT=true
- ADDITIONAL_LOCALES=nl_NL.UTF-8
volumes:
- ./php-fpm/php7.2.ini:/usr/local/etc/php/php.ini
- ../:/var/www:cached
expose:
- "9000"
networks:
- backend
### NGINX Server #########################################
nginx:
build:
context: ./nginx
args:
- PHP_UPSTREAM_CONTAINER=php-fpm
- PHP_UPSTREAM_PORT=9000
volumes:
- ../:/var/www:cached
- ./nginx/sites/:/etc/nginx/sites-available
- ./logs/nginx/:/var/log/nginx
- ./nginx/ssl/:/etc/nginx/ssl
ports:
- "80:80"
- "443:443"
depends_on:
- php-fpm
networks:
- frontend
- backend
labels:
- "kompose.service.type=LoadBalancer"
- "kompose.service.expose=organize.eduskoel.net"
### MariaDB ##############################################
mariadb:
build: ./mariadb
volumes:
- ~/.laradock/data/mariadb:/var/lib/mysql
- ./mariadb/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
ports:
- "3306:3306"
environment:
- MYSQL_DATABASE=
- MYSQL_USER=
- MYSQL_PASSWORD=
- MYSQL_ROOT_PASSWORD=
networks:
- backend
### Certbot #########################################
certbot:
build:
context: ./certbot
volumes:
- ./data/certbot/certs/:/var/certs
- ./certbot/letsencrypt/:/var/www/letsencrypt
environment:
- CN="organize.eduskoel.net"
- EMAIL=""
networks:
- frontend
### HAProxy ####################################
haproxy:
build: ./haproxy
ports:
- "8085:8085"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
links:
- proxy
- proxy2
我的nginx配置(位于/nginx/sites/default.conf中)如下所示:
server {
listen 80;
listen [::]:80;
# For https
# listen 443 ssl;
# listen [::]:443 ssl ipv6only=on;
# ssl_certificate /etc/nginx/ssl/default.crt;
# ssl_certificate_key /etc/nginx/ssl/default.key;
server_name organize.eduskoel.net;
root /var/www/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fixes timeouts
fastcgi_read_timeout 600;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location /.well-known/acme-challenge/ {
root /var/www/letsencrypt/;
log_not_found off;
}
error_log /var/log/nginx/laravel_error.log;
access_log /var/log/nginx/laravel_access.log;
}
如果要访问,请访问organization.eduskoel.net:您将看到:欢迎使用nginx。
所以,我的想法;将FQDN(organize.eduskoel.net)与定位的文件映射失败;它找不到根文件(v主机文件)。请注意,laravel的公用文件夹是应用程序的文档根目录。
有人有线索吗?预先感谢您对我的帮助!
凯文