我将开始为我的项目制作docker映像,因此我遵循一个教程在docker中创建一个lemp-stack。我有MySQL,PHP-FPM, nginx and PHPMyAdmin
正在运行并正常工作。我需要使用msqli
函数时出现的问题,并且在php confs中未启用。我需要取消对extension=mysqli
中的行php.ini
的注释,但是在php
容器中找不到该文件。我刚刚发现`/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini。
# cat docker-php-ext-sodium.ini
extension=sodium.so
我的docker-compose.yml
nginx:
image: tutum/nginx
ports:
- "80:80"
links:
- phpfpm
volumes:
- ./nginx/default:/etc/nginx/sites-available/default
- ./nginx/default:/etc/nginx/sites-enabled/default
- ./logs/nginx-error.log:/var/log/nginx/error.log
- ./logs/nginx-access.log:/var/log/nginx/access.log
phpfpm:
image: php:fpm
ports:
- "9000:9000"
volumes:
- ./public:/usr/share/nginx/html
mysql:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: [password]
phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: always
links:
- mysql
ports:
- 8183:80
environment:
MYSQL_USERNAME: [user]
MYSQL_ROOT_PASSWORD: [password]
PMA_ARBITRARY: 1
nginx /默认
server {
listen 80;
# this path MUST be exactly as docker-compose.fpm.volumes,
# even if it doesn't exists in this dock.
root /usr/share/nginx/html;
index index.php index.html index.html;
server_name 172.17.0.1;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
$树
.
├── docker-compose.yml
├── logs
│ ├── nginx-access.log
│ └── nginx-error.log
├── nginx
│ └── default
└── public
├── index.php
├── report.php