Skip to content

Commit e51618b

Browse files
author
whorusq
committed
update lamp3
1 parent dd43629 commit e51618b

File tree

9 files changed

+42
-17
lines changed

9 files changed

+42
-17
lines changed

lamp3/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ lamp3(基于 Compose 管理的 LAMP 运行环境)
1111

1212
```bash
1313
$ docker-compose up
14+
15+
# 或使用 --build 参数,对不存在的镜像进行编译
16+
$ docker-compose up --build
1417
```
1518

1619
### 测试
@@ -47,3 +50,4 @@ $ docker-compose rm
4750
> 1. 如果 build 和 image 同时指定,在 docker-compose up 时会首先基于 Dockerfile 编译,并指定镜像名称为 image 参数指定的。
4851
> 2. 如果只指定 build,则编译后的镜像名称为`根目录+服务名`,如:lamp3_mysql
4952
> 3. 如果只指定 image,启动时则直接基于对应的本地镜像。
53+

lamp3/docker-compose.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@
66
version: '2'
77

88
services:
9+
910
# PHP and Apache
1011
php_apache:
1112
build: ./php_apache
1213
image: lamp/php_apache
1314
ports:
1415
- "80:80"
15-
links:
16-
- mysql
1716
volumes:
1817
- ~/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+
1923
# MySQL
2024
mysql:
21-
build: ./mysql
25+
build: ./mysql
2226
image: lamp/mysql
2327
ports:
2428
- "3306:3306"
2529
volumes:
2630
- ~/data/mysql:/var/lib/mysql
31+

lamp3/mysql/Dockerfile

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ FROM mysql:5.6
99

1010
MAINTAINER whoru.S.Q <[email protected]>
1111

12+
# 时区设置
13+
ENV TZ=Asia/Shanghai
14+
1215
# 写权限
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/
1420

lamp3/php_apache/Dockerfile

+15-5
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ FROM php:5.6-apache
1111

1212
MAINTAINER whoru.S.Q <[email protected]>
1313

14+
# 时区设置
15+
ENV TZ=Asia/Shanghai
16+
1417
# 安装其它扩展
1518
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 \
1722
&& apt-get install -y \
1823
libfreetype6-dev \
1924
libjpeg62-turbo-dev \
@@ -31,16 +36,21 @@ RUN apt-get update \
3136
# 或 ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
3237
&& a2enmod rewrite \
3338

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+
3444
# 清理
3545
&& apt-get clean \
3646
&& apt-get autoclean \
3747
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
3848

3949
# 追加 PHP 自定义配置文件
40-
COPY config/php.ini /usr/local/etc/php/
50+
#COPY config/php.ini /usr/local/etc/php/
4151

4252
# 追加 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
4656

File renamed without changes.

lamp3/php_apache/config/sites-available/www.conf lamp3/php_apache/conf/apache/sites-available/www.conf

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
ServerName dev.www
44
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>
1212

1313
ErrorLog ${APACHE_LOG_DIR}/error.log
1414
CustomLog ${APACHE_LOG_DIR}/access.log combined

lamp3/php_apache/config/php.ini lamp3/php_apache/conf/php/php.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
date.timezone = "Asia/Shanghai"
33
memory_limit = 128m
44
upload_max_filesize = 16m
5-
post_max_size = 8000M
5+
post_max_size = 9000M
66
max_execution_time = 600
77
max_input_time = 600
88
memory_limit = 128m

0 commit comments

Comments
 (0)