File tree 9 files changed +42
-17
lines changed
9 files changed +42
-17
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ lamp3(基于 Compose 管理的 LAMP 运行环境)
11
11
12
12
``` bash
13
13
$ docker-compose up
14
+
15
+ # 或使用 --build 参数,对不存在的镜像进行编译
16
+ $ docker-compose up --build
14
17
```
15
18
16
19
### 测试
@@ -47,3 +50,4 @@ $ docker-compose rm
47
50
> 1 . 如果 build 和 image 同时指定,在 docker-compose up 时会首先基于 Dockerfile 编译,并指定镜像名称为 image 参数指定的。
48
51
> 2 . 如果只指定 build,则编译后的镜像名称为` 根目录+服务名 ` ,如:lamp3_mysql
49
52
> 3 . 如果只指定 image,启动时则直接基于对应的本地镜像。
53
+
Original file line number Diff line number Diff line change 6
6
version : ' 2'
7
7
8
8
services :
9
+
9
10
# PHP and Apache
10
11
php_apache :
11
12
build : ./php_apache
12
13
image : lamp/php_apache
13
14
ports :
14
15
- " 80:80"
15
- links :
16
- - mysql
17
16
volumes :
18
17
- ~/www:/var/www/html
18
+ - ./php_apache/conf/php/php.ini:/usr/local/etc/php/php.ini
19
+ - ./php_apache/conf/apache/apache2.conf:/etc/apache2/apache2.conf
20
+ - ./php_apache/conf/apache/sites-available:/etc/apache2/sites-available
21
+ - ./php_apache/conf/apache/sites-enabled:/etc/apache2/sites-enabled
22
+
19
23
# MySQL
20
24
mysql :
21
- build : ./mysql
25
+ build : ./mysql
22
26
image : lamp/mysql
23
27
ports :
24
28
- " 3306:3306"
25
29
volumes :
26
30
- ~/data/mysql:/var/lib/mysql
31
+
Original file line number Diff line number Diff line change @@ -9,6 +9,12 @@ FROM mysql:5.6
9
9
10
10
MAINTAINER whoru.S.Q <
[email protected] >
11
11
12
+ # 时区设置
13
+ ENV TZ=Asia/Shanghai
14
+
12
15
# 写权限
13
- RUN usermod -u 1000 mysql && chown mysql.mysql /var/run/mysqld/
16
+ RUN /bin/cp /usr/share/zoneinfo/$TZ /etc/localtime \
17
+ && echo $TZ > /etc/timezone \
18
+ && usermod -u 1000 mysql \
19
+ && chown mysql.mysql /var/run/mysqld/
14
20
Original file line number Diff line number Diff line change @@ -11,9 +11,14 @@ FROM php:5.6-apache
11
11
12
12
MAINTAINER whoru.S.Q <
[email protected] >
13
13
14
+ # 时区设置
15
+ ENV TZ=Asia/Shanghai
16
+
14
17
# 安装其它扩展
15
18
COPY ./source.list /etc/apt/sources.list
16
- RUN apt-get update \
19
+ RUN /bin/cp /usr/share/zoneinfo/$TZ /etc/localtime \
20
+ && echo $TZ > /etc/timezone \
21
+ && apt-get update \
17
22
&& apt-get install -y \
18
23
libfreetype6-dev \
19
24
libjpeg62-turbo-dev \
@@ -31,16 +36,21 @@ RUN apt-get update \
31
36
# 或 ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
32
37
&& a2enmod rewrite \
33
38
39
+ # 更改 web 根目录属主、属组,避免权限问题
40
+ # 运行时用户可通过 phinfo() 中查看 APACHE_RUN_USER 获取
41
+ # usermod -u 1000 www-data && usermod -G staff www-data
42
+ # && chown www-data:www-data /var/www/html \
43
+
34
44
# 清理
35
45
&& apt-get clean \
36
46
&& apt-get autoclean \
37
47
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
38
48
39
49
# 追加 PHP 自定义配置文件
40
- COPY config/php.ini /usr/local/etc/php/
50
+ # COPY config/php.ini /usr/local/etc/php/
41
51
42
52
# 追加 Apache 自定义配置文件
43
- COPY ./config/apache2.conf /etc/apache2/apache2.conf
44
- COPY ./config/sites-available /etc/apache2/sites-available
45
- COPY ./config/sites-enabled /etc/apache2/sites-enabled
53
+ # COPY ./config/apache2.conf /etc/apache2/apache2.conf
54
+ # COPY ./config/sites-available /etc/apache2/sites-available
55
+ # COPY ./config/sites-enabled /etc/apache2/sites-enabled
46
56
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 2
2
3
3
ServerName dev.www
4
4
DocumentRoot /var/www/html
5
-
6
- <Directory "/var/www/html" >
7
- AllowOverride All
8
- options FollowSymLinks
9
- Order allow,deny
10
- Allow from all
11
- </Directory >
5
+
6
+ <Directory "/var/www/html/debao " >
7
+ AllowOverride All
8
+ options FollowSymLinks
9
+ # Order allow,deny
10
+ # Allow from all
11
+ </Directory >
12
12
13
13
ErrorLog ${APACHE_LOG_DIR}/error.log
14
14
CustomLog ${APACHE_LOG_DIR}/access.log combined
File renamed without changes.
Original file line number Diff line number Diff line change 2
2
date.timezone = " Asia/Shanghai"
3
3
memory_limit = 128m
4
4
upload_max_filesize = 16m
5
- post_max_size = 8000M
5
+ post_max_size = 9000M
6
6
max_execution_time = 600
7
7
max_input_time = 600
8
8
memory_limit = 128m
You can’t perform that action at this time.
0 commit comments