标签:ref mongod 修改 ram 同步 always nmp rest 配置
之前已经写好了lnmp+memcached+mongodb+redis的dockerfile,接下来使用docker-compose来管理这些容器,使他们能串联起来同时为我们提供服务。
mkdir -p /data/docker/lnmp-test/dockerfile/nginx/conf
mkdir -p /data/docker/lnmp-test/dockerfile/nginx/conf/conf.d
mkdir -p /data/docker/lnmp-test/dockerfile/php/conf
mkdir -p /data/docker/lnmp-test/dockerfile/mysql/conf
mkdir -p /data/docker/lnmp-test/dockerfile/mongodb/conf
mkdir -p /data/docker/lnmp-test/dockerfile/redis/conf
mkdir -p /data/docker/lnmp-test/dockerfile/nginx/log
mkdir -p /data/docker/lnmp-test/dockerfile/php/log
mkdir -p /data/docker/lnmp-test/dockerfile/mongodb/log
mkdir -p /data/docker/lnmp-test/dockerfile/redis/log
mkdir -p /data/docker/lnmp-test/dockerfile/mysql/data
mkdir -p /data/docker/lnmp-test/dockerfile/mongodb/data
mkdir -p /data/docker/lnmp-test/dockerfile/redis/data
mkdir -p /data/docker/lnmp-test/dockerfile/nginx/www
cd /data/docker/lnmp-test/dockerfile/
vim docker-compose.yml
version: "3"
services:
#### mysql
mysql:
image: centos6:mysql
container_name: lianni-mysql
ports:
- "3306:3306"
volumes:
- ./mysql/conf/my.cnf:/etc/mysql/my.cnf:rw
- ./mysql/data/:/data/mysql/:rw
- /etc/localtime:/etc/localtime:rw
networks:
- net-lianni
restart: always
#### php
php:
image: centos6:php
container_name: lianni-php
ports:
- "9000:9000"
volumes:
- /a01/docker/lianni/dockerfile/nginx/www/:/usr/local/nginx/html/:rw
- ./php/conf/php.ini:/etc/php/php.ini:rw
- ./php/log/:/usr/local/php/var/log/:rw
- /etc/localtime:/etc/localtime:rw
networks:
- net-lianni
restart: always
#### nginx
nginx:
image: centos6:nginx
container_name: lianni-nginx
ports:
- "80:80"
volumes:
- ./nginx/www/:/usr/local/nginx/html/:rw
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf:rw
- ./nginx/conf/conf.d/:/etc/nginx/conf.d/:rw
- ./nginx/log/:/var/log/nginx/:rw
- /etc/localtime:/etc/localtime:rw
networks:
- net-lianni
restart: always
#### memcached
memcached:
image: centos6:memcached
container_name: lianni-memcached
ports:
- "11211:11211"
volumes:
- /etc/localtime:/etc/localtime:rw
networks:
- net-lianni
restart: always
#### mongodb
mongodb:
image: centos6:mongodb
container_name: lianni-mongodb
ports:
- "27017:27017"
volumes:
- ./mongodb/conf/mongodb.conf:/etc/mongodb/mongodb.conf:rw
- ./mongodb/data/:/mongodb/data/:rw
- ./mongodb/log:/mongodb/log/:rw
- /etc/localtime:/etc/localtime:rw
networks:
- net-lianni
restart: always
#### redis
redis:
image: centos6:redis
container_name: lianni-redis
ports:
- "6379:6379"
volumes:
- ./redis/conf/redis.conf:/etc/redis/redis.conf:rw
- ./redis/data/:/data/redis/:rw
- ./redis/log/:/data/log/:rw
- /etc/localtime:/etc/localtime:rw
networks:
- net-lianni
restart: always
#### networks
networks:
net-lianni:
vim /data/docker/lnmp-test/dockerfile/mysql/conf/my.cnf
vim /data/docker/lnmp-test/dockerfile/php/conf/php.ini
vim /data/docker/lnmp-test/dockerfile/nginx/conf/nginx.conf
vim /data/docker/lnmp-test/dockerfile/mongodb/conf/mongodb.conf
vim /data/docker/lnmp-test/dockerfile/redis/conf/redis.conf
docker-compose -f /data/docker/lnmp-test/dockerfile/docker-compose.yml up -d
cd /data/docker/lnmp-test/dockerfile/
docker-compose ps
cd /data/docker/lnmp-test/dockerfile/nginx/www/
vim index.php
<?php
phpinfo();
?>
cd /data/docker/lnmp-test/dockerfile/nginx/conf/
vim nginx.conf
location / {
root html;
index index.php index.html index.htm;
}
……
location ~ \.php$ {
root html;
fastcgi_pass lnmptest-php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
cd /data/docker/lnmp-test/dockerfile/php/conf/
vim php.ini
[igbinary]
extension=igbinary.so
[memcached]
extension=memcached.so
[redis]
extension=redis.so
[imagick]
extension=imagick.so
[bcmath]
extension=bcmath.so
[apcu]
extension=apcu.so
[phalcon]
extension=phalcon.so
[mongodb]
extension = mongodb.so
reboot
标签:ref mongod 修改 ram 同步 always nmp rest 配置
原文地址:https://www.cnblogs.com/93bok/p/9684949.html