File tree 6 files changed +45
-24
lines changed
6 files changed +45
-24
lines changed Original file line number Diff line number Diff line change @@ -12,23 +12,39 @@ RUN apt-get update && \
12
12
13
13
RUN apt-get update && \
14
14
apt-get remove php7.0 && \
15
- apt-get install -y --no-install-recommends --no-install-suggests nginx php7.2 php7.2-fpm php7.2-cli php7.2-common ca-certificates gettext && \
15
+ apt-get install -y --no-install-recommends \
16
+ php5.6-bcmath \
17
+ php5.6-cgi \
18
+ php5.6-cli \
19
+ php5.6-common \
20
+ php5.6-fpm \
21
+ php5.6-gd \
22
+ php5.6-json \
23
+ php5.6-mbstring \
24
+ php5.6-mcrypt \
25
+ php5.6-mysql \
26
+ php5.6-opcache \
27
+ php5.6-readline \
28
+ php5.6-xcache \
29
+ php5.6-xml \
30
+ nginx \
31
+ ca-certificates gettext && \
16
32
rm -rf /var/lib/apt/lists/*
17
33
18
34
# forward request and error logs to docker log collector
19
35
RUN ln -sf /dev/stderr /var/log/nginx/access.log \
20
36
&& ln -sf /dev/stderr /var/log/nginx/error.log \
21
- && ln -sf /dev/stderr /var/log/php7.2 -fpm.log \
37
+ && ln -sf /dev/stderr /var/log/php5.6 -fpm.log \
22
38
&& ln -sf /dev/stderr /var/log/php-fpm.log
23
39
24
40
RUN rm -f /etc/nginx/sites-enabled/*
25
41
26
42
COPY nginx.conf.tpl /tmp/nginx.conf.tpl
27
43
COPY php-fpm.conf.tpl /tmp/php-fpm.conf.tpl
28
- COPY defaults.ini /etc/php/7.2 /cli/conf.d/defaults.ini
29
- COPY defaults.ini /etc/php/7.2 /fpm/conf.d/defaults.ini
44
+ COPY defaults.ini /etc/php/5.6 /cli/conf.d/defaults.ini
45
+ COPY defaults.ini /etc/php/5.6 /fpm/conf.d/defaults.ini
30
46
31
- RUN mkdir -p /run/php && touch /run/php/php7.2 -fpm.sock && touch /run/php/php7.2 -fpm.pid
47
+ RUN mkdir -p /run/php && touch /run/php/php5.6 -fpm.sock && touch /run/php/php5.6 -fpm.pid
32
48
33
49
COPY entrypoint.sh /entrypoint.sh
34
50
RUN chmod 755 /entrypoint.sh
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
3
export NGINX_WEB_ROOT=${NGINX_WEB_ROOT:- ' /var/www/html' }
4
- export NGINX_PHP_FALLBACK=${NGINX_PHP_FALLBACK:- ' /app .php' }
5
- export NGINX_PHP_LOCATION=${NGINX_PHP_LOCATION:- ' ^/app \.php(/|$) ' }
4
+ export NGINX_PHP_FALLBACK=${NGINX_PHP_FALLBACK:- ' /index .php' }
5
+ export NGINX_PHP_LOCATION=${NGINX_PHP_LOCATION:- ' ^\.php$ ' }
6
6
export NGINX_USER=${NGINX_USER:- ' www-data' }
7
7
export NGINX_CONF=${NGINX_CONF:- ' /etc/nginx/nginx.conf' }
8
8
9
9
export PHP_SOCK_FILE=${PHP_SOCK_FILE:- ' /run/php.sock' }
10
10
export PHP_USER=${PHP_USER:- ' www-data' }
11
11
export PHP_GROUP=${PHP_GROUP:- ' www-data' }
12
12
export PHP_MODE=${PHP_MODE:- ' 0660' }
13
- export PHP_FPM_CONF=${PHP_FPM_CONF:- ' /etc/php/7.2 /fpm/php-fpm.conf' }
13
+ export PHP_FPM_CONF=${PHP_FPM_CONF:- ' /etc/php/5.6 /fpm/php-fpm.conf' }
14
14
15
15
envsubst ' ${NGINX_WEB_ROOT} ${NGINX_PHP_FALLBACK} ${NGINX_PHP_LOCATION} ${NGINX_USER} ${NGINX_CONF} ${PHP_SOCK_FILE} ${PHP_USER} ${PHP_GROUP} ${PHP_MODE} ${PHP_FPM_CONF}' < /tmp/nginx.conf.tpl > $NGINX_CONF
16
16
envsubst ' ${NGINX_WEB_ROOT} ${NGINX_PHP_FALLBACK} ${NGINX_PHP_LOCATION} ${NGINX_USER} ${NGINX_CONF} ${PHP_SOCK_FILE} ${PHP_USER} ${PHP_GROUP} ${PHP_MODE} ${PHP_FPM_CONF}' < /tmp/php-fpm.conf.tpl > $PHP_FPM_CONF
@@ -22,7 +22,7 @@ nginx -c $NGINX_CONF -g 'daemon off;' 2>&1 &
22
22
NGINX_PID=$!
23
23
24
24
echo ' Starting PHP-FPM' ;
25
- php-fpm7.2 -R -F -c $PHP_FPM_CONF 2>&1 &
25
+ php-fpm5.6 -R -F -c $PHP_FPM_CONF 2>&1 &
26
26
PHP_FPM_PID=$!
27
27
28
28
trap " TRAPPED_SIGNAL=true; kill -15 $NGINX_PID ; kill -15 $PHP_FPM_PID ;" SIGTERM SIGINT
Original file line number Diff line number Diff line change @@ -36,20 +36,22 @@ http {
36
36
location / {
37
37
try_files $uri $NGINX_PHP_FALLBACK $is_args $args ;
38
38
}
39
- location ~ $NGINX_PHP_LOCATION {
39
+
40
+ location ~ [^/]\.php(/|$) {
41
+ fastcgi_split_path_info ^(.+?\.php)(/.*)$;
42
+ if (! -f $document_root $fastcgi_script_name ) {
43
+ return 404;
44
+ }
45
+
46
+ fastcgi_param HTTP_PROXY "";
47
+
40
48
fastcgi_pass unix:$PHP_SOCK_FILE;
41
- fastcgi_split_path_info ^(.+\.php)(/.*)$;
42
- include fastcgi_params;
43
- fastcgi_param SCRIPT_FILENAME $realpath_root $fastcgi_script_name ;
44
- fastcgi_param DOCUMENT_ROOT $realpath_root ;
49
+ fastcgi_index index.php;
45
50
46
- internal;
47
- }
51
+ # include the fastcgi_param setting
52
+ include fastcgi_params;
48
53
49
- # return 404 for all other php files not matching the front controller
50
- # this prevents access to other php files you don't want to be accessible.
51
- location ~ \.php$ {
52
- return 404;
54
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
53
55
}
54
56
}
55
57
}
Original file line number Diff line number Diff line change
1
+ [global]
2
+ error_log = /var/log/php5.6-fpm.log
3
+
1
4
[www]
2
5
3
6
pm = dynamic
@@ -15,3 +18,5 @@ listen = $PHP_SOCK_FILE
15
18
listen.owner = $PHP_USER
16
19
listen.group = $PHP_GROUP
17
20
listen.mode = $PHP_MODE
21
+
22
+ php_admin_flag[log_errors] = on
Original file line number Diff line number Diff line change 3
3
set -x
4
4
set -e
5
5
6
- (cd base && docker build --rm --pull -t formapro/nginx-php-fpm:latest .)
7
- (cd php-all-exts && docker build --rm -t formapro/nginx-php-fpm:latest-all-exts .)
6
+ (cd base && docker build --rm --pull -t beanieboi/nginx-php-fpm:5.6 .)
Original file line number Diff line number Diff line change 3
3
set -x
4
4
set -e
5
5
6
- docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
7
- docker push formapro/nginx-php-fpm;
6
+ docker push beanieboi/nginx-php-fpm;
You can’t perform that action at this time.
0 commit comments