Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zgfh committed Jun 7, 2018
1 parent aab02b9 commit 4031946
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 51 deletions.
33 changes: 23 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,32 @@
############################################################

# Set the base image to Ubuntu
FROM centos:latest

# File Author / Maintainer
MAINTAINER Kaushal Kishore <[email protected]>

# Add the ngix and PHP dependent repository
ADD nginx.repo /etc/yum.repos.d/nginx.repo
FROM centos:7

ENV nginxversion="1.12.2-1" \
os="centos" \
osversion="7" \
elversion="7_4"
# Installing nginx
RUN yum -y install nginx
RUN yum install -y wget openssl sed &&\
yum -y autoremove &&\
yum clean all &&\
wget http://nginx.org/packages/$os/$osversion/x86_64/RPMS/nginx-$nginxversion.el$elversion.ngx.x86_64.rpm &&\
rpm -iv nginx-$nginxversion.el$elversion.ngx.x86_64.rpm

# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log

# Installing PHP
RUN yum -y --enablerepo=remi,remi-php56 install nginx php-fpm php-common
RUN rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm && rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
RUN yum -y install php56w php56w-cli php56w-common php56w-fpm \
yum -y autoremove &&\
yum clean all
# Installing PHP
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 \
yum -y autoremove &&\
yum clean all

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

# Adding the default file
ADD index.php /var/www/index.php

ADD php-fpm.conf /etc/php-fpm.conf
# Set the port to 80
EXPOSE 80

Expand Down
12 changes: 3 additions & 9 deletions default.conf
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
server {
listen 80;
listen 80 default_server;

root /var/www;
index index.html index.htm index.php;

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

access_log /var/log/nginx/localhost.com-access.log;
error_log /var/log/nginx/localhost.com-error.log error;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log error;

charset utf-8;

location / {
try_files $uri $uri/ /index.html /index.php?$query_string;
}

location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { access_log off; log_not_found off; }

error_page 404 /index.php;

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
Expand Down
25 changes: 0 additions & 25 deletions nginx.repo

This file was deleted.

25 changes: 25 additions & 0 deletions php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
; This file was initially adapated from the output of: (on PHP 5.6)
; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default

[global]

error_log = /proc/self/fd/2
daemonize = no

[www]

; if we send this to /proc/self/fd/1, it never appears
access.log = /proc/self/fd/2

user = apache
group = apache

listen = [::]:9000

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

clear_env = no
17 changes: 10 additions & 7 deletions supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@ nodaemon=true ; (start in foreground if true;default false)
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[program:php5-fpm]
command=/usr/sbin/php-fpm -c /etc/php-fpm.d
command=/usr/sbin/php-fpm -F -c /etc/php-fpm.d
numprocs=1
autostart=true
autorestart=true

[program:php5-fpm-log]
command=tail -f /var/log/php5-fpm.log
stdout_events_enabled=true
stderr_events_enabled=true
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

[program:nginx]
command=/usr/sbin/nginx
numprocs=1
autostart=true
autorestart=true
autorestart=true
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

0 comments on commit 4031946

Please sign in to comment.