Skip to content

Commit 4031946

Browse files
author
朱争光
committed
update
1 parent aab02b9 commit 4031946

File tree

5 files changed

+61
-51
lines changed

5 files changed

+61
-51
lines changed

Dockerfile

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,32 @@
44
############################################################
55

66
# Set the base image to Ubuntu
7-
FROM centos:latest
8-
9-
# File Author / Maintainer
10-
MAINTAINER Kaushal Kishore <[email protected]>
11-
12-
# Add the ngix and PHP dependent repository
13-
ADD nginx.repo /etc/yum.repos.d/nginx.repo
7+
FROM centos:7
148

9+
ENV nginxversion="1.12.2-1" \
10+
os="centos" \
11+
osversion="7" \
12+
elversion="7_4"
1513
# Installing nginx
16-
RUN yum -y install nginx
14+
RUN yum install -y wget openssl sed &&\
15+
yum -y autoremove &&\
16+
yum clean all &&\
17+
wget http://nginx.org/packages/$os/$osversion/x86_64/RPMS/nginx-$nginxversion.el$elversion.ngx.x86_64.rpm &&\
18+
rpm -iv nginx-$nginxversion.el$elversion.ngx.x86_64.rpm
19+
20+
# forward request and error logs to docker log collector
21+
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
22+
&& ln -sf /dev/stderr /var/log/nginx/error.log
1723

1824
# Installing PHP
19-
RUN yum -y --enablerepo=remi,remi-php56 install nginx php-fpm php-common
25+
RUN rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm && rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
26+
RUN yum -y install php56w php56w-cli php56w-common php56w-fpm \
27+
yum -y autoremove &&\
28+
yum clean all
29+
# Installing PHP
30+
RUN yum -y install php56w-bcmath php56w-dba php56w-devel php56w-embedded php56w-enchant php56w-gd php56w-imap php56w-interbase php56w-intl php56w-ldap php56w-mbstring php56w-mcrypt php56w-mssql php56w-mysql php56w-odbc php56w-opcache php56w-pdo php56w-pecl-apcu php56w-pecl-apcu-devel php56w-pecl-gearman php56w-pecl-geoip php56w-pecl-igbinary php56w-pecl-igbinary-devel php56w-pecl-imagick php56w-pecl-imagick-devel php56w-pecl-libsodium php56w-pecl-memcache php56w-pecl-memcached php56w-pecl-mongodb php56w-pecl-redis php56w-pecl-xdebug php56w-pgsql php56w-phpdbg php56w-process php56w-pspell php56w-recode php56w-snmp php56w-soap php56w-tidy php56w-xml php56w-xmlrpc \
31+
yum -y autoremove &&\
32+
yum clean all
2033

2134
# Installing supervisor
2235
RUN yum install -y python-setuptools
@@ -33,7 +46,7 @@ ADD supervisord.conf /etc/
3346

3447
# Adding the default file
3548
ADD index.php /var/www/index.php
36-
49+
ADD php-fpm.conf /etc/php-fpm.conf
3750
# Set the port to 80
3851
EXPOSE 80
3952

default.conf

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
server {
2-
listen 80;
2+
listen 80 default_server;
33

44
root /var/www;
55
index index.html index.htm index.php;
66

7-
# Make site accessible from http://set-ip-address.xip.io
87
server_name localhost;
98

10-
access_log /var/log/nginx/localhost.com-access.log;
11-
error_log /var/log/nginx/localhost.com-error.log error;
9+
access_log /var/log/nginx/access.log;
10+
error_log /var/log/nginx/error.log error;
1211

1312
charset utf-8;
1413

1514
location / {
1615
try_files $uri $uri/ /index.html /index.php?$query_string;
1716
}
1817

19-
location = /favicon.ico { log_not_found off; access_log off; }
20-
location = /robots.txt { access_log off; log_not_found off; }
21-
22-
error_page 404 /index.php;
23-
2418
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
2519
#
2620
location ~ \.php$ {

nginx.repo

Lines changed: 0 additions & 25 deletions
This file was deleted.

php-fpm.conf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
; This file was initially adapated from the output of: (on PHP 5.6)
2+
; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default
3+
4+
[global]
5+
6+
error_log = /proc/self/fd/2
7+
daemonize = no
8+
9+
[www]
10+
11+
; if we send this to /proc/self/fd/1, it never appears
12+
access.log = /proc/self/fd/2
13+
14+
user = apache
15+
group = apache
16+
17+
listen = [::]:9000
18+
19+
pm = dynamic
20+
pm.max_children = 5
21+
pm.start_servers = 2
22+
pm.min_spare_servers = 1
23+
pm.max_spare_servers = 3
24+
25+
clear_env = no

supervisord.conf

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@ nodaemon=true ; (start in foreground if true;default false)
1111
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
1212

1313
[program:php5-fpm]
14-
command=/usr/sbin/php-fpm -c /etc/php-fpm.d
14+
command=/usr/sbin/php-fpm -F -c /etc/php-fpm.d
1515
numprocs=1
1616
autostart=true
1717
autorestart=true
18-
19-
[program:php5-fpm-log]
20-
command=tail -f /var/log/php5-fpm.log
21-
stdout_events_enabled=true
22-
stderr_events_enabled=true
18+
stderr_logfile=/dev/stderr
19+
stderr_logfile_maxbytes=0
20+
stdout_logfile=/dev/stdout
21+
stdout_logfile_maxbytes=0
2322

2423
[program:nginx]
2524
command=/usr/sbin/nginx
2625
numprocs=1
27-
autostart=true
2826
autorestart=true
27+
autorestart=true
28+
stderr_logfile=/dev/stderr
29+
stderr_logfile_maxbytes=0
30+
stdout_logfile=/dev/stdout
31+
stdout_logfile_maxbytes=0
2932

0 commit comments

Comments
 (0)