(Add Base: Lnmp) nginx + php5-fpm

This commit is contained in:
Medicean 2016-08-27 17:21:52 +08:00
parent 9300cb20d1
commit 7e349a92e8
5 changed files with 119 additions and 0 deletions

31
base/lnmp/Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM ubuntu:14.04
MAINTAINER Medici.Yan <Medici.Yan@Gmail.com>
RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Update sources
RUN apt-get update -y
RUN apt-get install -y vim bash-completion unzip build-essential gcc g++ autoconf libiconv-hook-dev libmcrypt-dev libxml2-dev libmysqlclient-dev libcurl4-openssl-dev libjpeg8-dev libpng12-dev libfreetype6-dev snmp mcrypt
# install mysql
RUN echo "mysql-server-5.5 mysql-server/root_password password root" | debconf-set-selections \
&& echo "mysql-server-5.5 mysql-server/root_password_again password root" | debconf-set-selections \
&& apt-get -y install mysql-server-5.5 mysql-client
# nginx php
RUN apt-get install -y nginx php5-fpm php5 php5-common php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-xcache php5-mcrypt
COPY src/default /etc/nginx/sites-available/default
COPY src/phpinfo.php /usr/share/nginx/html/phpinfo.php
RUN chown -R www-data:www-data /usr/share/nginx/html \
&& ln -s /usr/share/nginx/html /html
COPY src/start.sh /start.sh
RUN chmod a+x /start.sh
EXPOSE 80 443
CMD ["/start.sh"]

26
base/lnmp/README.md Normal file
View File

@ -0,0 +1,26 @@
## Ubuntu-lnmp 环境
> 后续相关 PHP 环境基础镜像
### 信息
类型 | 用户名 | 密码
:-:|:-:|:-:
Mysql | root | root
网站根目录 `/html/``/usr/share/nginx/html`
### 获取环境:
1. 拉取镜像到本地
```
$ docker pull medicean/vulapps:base_lnmp
```
2. 启动环境
```
$ docker run -d -p 8000:80 medicean/vulapps:base_lnmp
```
> `-p 8000:80` 前面的 8000 代表物理机的端口,可随意指定。

53
base/lnmp/src/default Normal file
View File

@ -0,0 +1,53 @@
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass http://127.0.0.1:8080;
#}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/html;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}

View File

@ -0,0 +1,3 @@
<?php
phpinfo();
?>

6
base/lnmp/src/start.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
/etc/init.d/mysql restart
/etc/init.d/nginx restart
/etc/init.d/php5-fpm restart
/usr/bin/tail -f /dev/null