Skip to content

Commit 81e35f0

Browse files
author
Levent.Sagiroglu
committed
conf
1 parent 5da15d4 commit 81e35f0

File tree

4 files changed

+48
-33
lines changed

4 files changed

+48
-33
lines changed

Dockerfile

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
FROM hasholding/alpine-base:3.8
1+
FROM hasholding/nginx
22
LABEL maintainer "Levent SAGIROGLU <[email protected]>"
3-
VOLUME /shared
4-
RUN apk add nginx php7-fpm
5-
RUN mkdir -p /run/nginx
6-
RUN sed -i 's/user = nobody/user = nginx/g' /etc/php7/php-fpm.d/www.conf
7-
RUN sed -i 's/group = nobody/group = nginx/g' /etc/php7/php-fpm.d/www.conf
83

9-
RUN echo "<?php phpinfo();" >/var/lib/nginx/html/info.php
10-
RUN chmod 755 /var/lib/nginx/html/info.php
4+
EXPOSE 80 443
5+
ENV PHP_CONF "/etc/php7/php-fpm.d/www.conf"
6+
ENV WEB_CONF "/etc/nginx/conf.d/default.conf"
7+
VOLUME /shared
118

12-
ENV PHP_CONF "/etc/php7/php-fpm.d"
13-
ENV CONF "/shared/local.conf"
9+
RUN apk add --update --no-cache php7-fpm && \
10+
sed -i 's/user = nobody/user = nginx/g' /etc/php7/php-fpm.d/www.conf && \
11+
sed -i 's/group = nobody/group = nginx/g' /etc/php7/php-fpm.d/www.conf && \
12+
echo "<?php phpinfo();" >/var/lib/nginx/html/info.php && \
13+
chmod 755 /var/lib/nginx/html/info.php
1414

15-
EXPOSE 80 443
1615
COPY entrypoint.sh /bin/entrypoint.sh
17-
COPY local.conf /shared/local.conf
16+
COPY default.conf /etc/nginx/conf.d/default.conf
1817
ENTRYPOINT ["/bin/entrypoint.sh"]

default.conf

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This is a default site configuration which will simply return 404, preventing
2+
# chance access to any other virtualhost.
3+
4+
server {
5+
listen 80 default_server;
6+
listen [::]:80 default_server;
7+
8+
location / {
9+
root /var/lib/nginx/html/;
10+
index index.php index.html index.htm;
11+
}
12+
13+
location ~ \.php$ {
14+
15+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
16+
fastcgi_pass localhost:9000;
17+
include /etc/nginx/fastcgi_params;
18+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
19+
}
20+
}
21+
22+
23+

entrypoint.sh

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
#!/bin/sh
2-
cp -u /etc/php7/php-fpm.d/www.conf ${PHP_CONF}
3-
cp -u ${CONF} /etc/nginx/conf.d/
2+
3+
if [ -f "${PHP_CONF}" ];
4+
then
5+
cp -f ${PHP_CONF} /etc/php7/php-fpm.d/www.conf
6+
fi
7+
8+
if [ -f "${WEB_CONF}" ];
9+
then
10+
cp -f ${WEB_CONF} /etc/nginx/conf.d/default.conf
11+
fi
12+
413
/usr/sbin/php-fpm7
514
/usr/sbin/nginx -g "daemon off;"
15+
16+
17+

local.conf

-19
This file was deleted.

0 commit comments

Comments
 (0)