Skip to content

Commit 1e4ab55

Browse files
authored
Merge pull request #79 from linuxserver/conf.d
fix for conf.d>http.d and formatting updates
2 parents b79a58f + c51c051 commit 1e4ab55

File tree

8 files changed

+113
-136
lines changed

8 files changed

+113
-136
lines changed

Dockerfile

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@ FROM ghcr.io/linuxserver/baseimage-alpine:3.13
22

33
# install packages
44
RUN \
5-
echo "**** install build packages ****" && \
6-
apk add --no-cache \
7-
apache2-utils \
8-
git \
9-
libressl3.1-libssl \
10-
logrotate \
11-
nano \
12-
nginx \
13-
openssl \
14-
php7 \
15-
php7-fileinfo \
16-
php7-fpm \
17-
php7-json \
18-
php7-mbstring \
19-
php7-openssl \
20-
php7-session \
21-
php7-simplexml \
22-
php7-xml \
23-
php7-xmlwriter \
24-
php7-zlib && \
25-
echo "**** configure nginx ****" && \
26-
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
27-
/etc/nginx/fastcgi_params && \
28-
rm -f /etc/nginx/conf.d/default.conf && \
29-
echo "**** fix logrotate ****" && \
30-
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
31-
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
32-
/etc/periodic/daily/logrotate
5+
echo "**** install build packages ****" && \
6+
apk add --no-cache \
7+
apache2-utils \
8+
git \
9+
libressl3.1-libssl \
10+
logrotate \
11+
nano \
12+
nginx \
13+
openssl \
14+
php7 \
15+
php7-fileinfo \
16+
php7-fpm \
17+
php7-json \
18+
php7-mbstring \
19+
php7-openssl \
20+
php7-session \
21+
php7-simplexml \
22+
php7-xml \
23+
php7-xmlwriter \
24+
php7-zlib && \
25+
echo "**** configure nginx ****" && \
26+
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
27+
/etc/nginx/fastcgi_params && \
28+
rm -f /etc/nginx/http.d/default.conf && \
29+
echo "**** fix logrotate ****" && \
30+
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
31+
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
32+
/etc/periodic/daily/logrotate
3333

3434
# add local files
3535
COPY root/ /

Dockerfile.aarch64

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@ FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.13
22

33
# install packages
44
RUN \
5-
echo "**** install build packages ****" && \
6-
apk add --no-cache \
7-
apache2-utils \
8-
git \
9-
libressl3.1-libssl \
10-
logrotate \
11-
nano \
12-
nginx \
13-
openssl \
14-
php7 \
15-
php7-fileinfo \
16-
php7-fpm \
17-
php7-json \
18-
php7-mbstring \
19-
php7-openssl \
20-
php7-session \
21-
php7-simplexml \
22-
php7-xml \
23-
php7-xmlwriter \
24-
php7-zlib && \
25-
echo "**** configure nginx ****" && \
26-
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
27-
/etc/nginx/fastcgi_params && \
28-
rm -f /etc/nginx/conf.d/default.conf && \
29-
echo "**** fix logrotate ****" && \
30-
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
31-
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
32-
/etc/periodic/daily/logrotate
5+
echo "**** install build packages ****" && \
6+
apk add --no-cache \
7+
apache2-utils \
8+
git \
9+
libressl3.1-libssl \
10+
logrotate \
11+
nano \
12+
nginx \
13+
openssl \
14+
php7 \
15+
php7-fileinfo \
16+
php7-fpm \
17+
php7-json \
18+
php7-mbstring \
19+
php7-openssl \
20+
php7-session \
21+
php7-simplexml \
22+
php7-xml \
23+
php7-xmlwriter \
24+
php7-zlib && \
25+
echo "**** configure nginx ****" && \
26+
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
27+
/etc/nginx/fastcgi_params && \
28+
rm -f /etc/nginx/http.d/default.conf && \
29+
echo "**** fix logrotate ****" && \
30+
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
31+
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
32+
/etc/periodic/daily/logrotate
3333

3434
# add local files
3535
COPY root/ /

Dockerfile.armhf

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@ FROM ghcr.io/linuxserver/baseimage-alpine:arm32v7-3.13
22

33
# install packages
44
RUN \
5-
echo "**** install build packages ****" && \
6-
apk add --no-cache \
7-
apache2-utils \
8-
git \
9-
libressl3.1-libssl \
10-
logrotate \
11-
nano \
12-
nginx \
13-
openssl \
14-
php7 \
15-
php7-fileinfo \
16-
php7-fpm \
17-
php7-json \
18-
php7-mbstring \
19-
php7-openssl \
20-
php7-session \
21-
php7-simplexml \
22-
php7-xml \
23-
php7-xmlwriter \
24-
php7-zlib && \
25-
echo "**** configure nginx ****" && \
26-
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
27-
/etc/nginx/fastcgi_params && \
28-
rm -f /etc/nginx/conf.d/default.conf && \
29-
echo "**** fix logrotate ****" && \
30-
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
31-
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
32-
/etc/periodic/daily/logrotate
5+
echo "**** install build packages ****" && \
6+
apk add --no-cache \
7+
apache2-utils \
8+
git \
9+
libressl3.1-libssl \
10+
logrotate \
11+
nano \
12+
nginx \
13+
openssl \
14+
php7 \
15+
php7-fileinfo \
16+
php7-fpm \
17+
php7-json \
18+
php7-mbstring \
19+
php7-openssl \
20+
php7-session \
21+
php7-simplexml \
22+
php7-xml \
23+
php7-xmlwriter \
24+
php7-zlib && \
25+
echo "**** configure nginx ****" && \
26+
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
27+
/etc/nginx/fastcgi_params && \
28+
rm -f /etc/nginx/http.d/default.conf && \
29+
echo "**** fix logrotate ****" && \
30+
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
31+
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
32+
/etc/periodic/daily/logrotate
3333

3434
# add local files
3535
COPY root/ /

root/defaults/default

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@ server {
1919

2020
location ~ \.php$ {
2121
fastcgi_split_path_info ^(.+\.php)(/.+)$;
22-
# With php5-cgi alone:
2322
fastcgi_pass 127.0.0.1:9000;
24-
# With php5-fpm:
25-
#fastcgi_pass unix:/var/run/php5-fpm.sock;
2623
fastcgi_index index.php;
2724
include /etc/nginx/fastcgi_params;
28-
2925
}
3026
}

root/defaults/nginx.conf

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2018/08/16 - Changelog: https://github.com/linuxserver/docker-baseimage-alpine-nginx/commits/master/root/defaults/nginx.conf
1+
## Version 2021/06/15 - Changelog: https://github.com/linuxserver/docker-baseimage-alpine-nginx/commits/master/root/defaults/nginx.conf
22

33
user abc;
44
worker_processes 4;
@@ -72,31 +72,9 @@ http {
7272
##
7373
# Virtual Host Configs
7474
##
75-
include /etc/nginx/conf.d/*.conf;
75+
include /etc/nginx/http.d/*.conf;
7676
include /config/nginx/site-confs/*;
7777

7878
}
7979

80-
81-
#mail {
82-
# # See sample authentication script at:
83-
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
84-
#
85-
# # auth_http localhost/auth.php;
86-
# # pop3_capabilities "TOP" "USER";
87-
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
88-
#
89-
# server {
90-
# listen localhost:110;
91-
# protocol pop3;
92-
# proxy on;
93-
# }
94-
#
95-
# server {
96-
# listen localhost:143;
97-
# protocol imap;
98-
# proxy on;
99-
# }
100-
#}
10180
daemon off;
102-

root/etc/cont-init.d/20-config

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
# make our folders
44
mkdir -p \
5-
/config/{nginx/site-confs,www,log/nginx,keys,log/php,php} \
6-
/run \
7-
/var/lib/nginx/tmp/client_body \
8-
/var/tmp/nginx
5+
/config/{nginx/site-confs,www,log/nginx,keys,log/php,php} \
6+
/run \
7+
/var/lib/nginx/tmp/client_body \
8+
/var/tmp/nginx
99

1010
# copy config files
1111
[[ ! -f /config/nginx/nginx.conf ]] && \
12-
cp /defaults/nginx.conf /config/nginx/nginx.conf
12+
cp /defaults/nginx.conf /config/nginx/nginx.conf
1313
[[ ! -f /config/nginx/site-confs/default ]] && \
14-
cp /defaults/default /config/nginx/site-confs/default
14+
cp /defaults/default /config/nginx/site-confs/default
1515
[[ $(find /config/www -type f | wc -l) -eq 0 ]] && \
16-
cp /defaults/index.html /config/www/index.html
16+
cp /defaults/index.html /config/www/index.html
1717

1818
# create local php.ini if it doesn't exist, set local timezone
1919
[[ ! -f /config/php/php-local.ini ]] && \
20-
printf "; Edit this file to override php.ini directives and restart the container\\n\\ndate.timezone = %s\\n" "$TZ" > /config/php/php-local.ini
20+
printf "; Edit this file to override php.ini directives and restart the container\\n\\ndate.timezone = %s\\n" "$TZ" > /config/php/php-local.ini
2121
# copy user php-local.ini to image
2222
cp /config/php/php-local.ini /etc/php7/conf.d/php-local.ini
2323
#fix php-fpm log location
@@ -27,15 +27,20 @@ sed -i "s#user = nobody.*#user = abc#g" /etc/php7/php-fpm.d/www.conf
2727
sed -i "s#group = nobody.*#group = abc#g" /etc/php7/php-fpm.d/www.conf
2828
# create override for www.conf if it doesn't exist
2929
[[ ! -f /config/php/www2.conf ]] && \
30-
printf "; Edit this file to override www.conf and php-fpm.conf directives and restart the container\\n\\n; Pool name\\n[www]\\n\\n" > /config/php/www2.conf
30+
printf "; Edit this file to override www.conf and php-fpm.conf directives and restart the container\\n\\n; Pool name\\n[www]\\n\\n" > /config/php/www2.conf
3131
# copy user www2.conf to image
3232
cp /config/php/www2.conf /etc/php7/php-fpm.d/www2.conf
3333

34+
# backwards compatibility for alpine >=3.14
35+
if [ ! -e /etc/nginx/conf.d ]; then
36+
ln -s /etc/nginx/http.d /etc/nginx/conf.d
37+
fi
38+
3439
# permissions
3540
chown -R abc:abc \
36-
/config \
37-
/var/lib/nginx \
38-
/var/tmp/nginx
41+
/config \
42+
/var/lib/nginx \
43+
/var/tmp/nginx
3944
chmod -R g+w \
40-
/config/{nginx,www}
45+
/config/{nginx,www}
4146
chmod -R 644 /etc/logrotate.d

root/etc/cont-init.d/30-keygen

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#!/usr/bin/with-contenv bash
22
SUBJECT="/C=US/ST=CA/L=Carlsbad/O=Linuxserver.io/OU=LSIO Server/CN=*"
33
if [[ -f /config/keys/cert.key && -f /config/keys/cert.crt ]]; then
4-
echo "using keys found in /config/keys"
4+
echo "using keys found in /config/keys"
55
else
6-
echo "generating self-signed keys in /config/keys, you can replace these with your own keys if required"
7-
openssl req -new -x509 -days 3650 -nodes -out /config/keys/cert.crt -keyout /config/keys/cert.key -subj "$SUBJECT"
6+
echo "generating self-signed keys in /config/keys, you can replace these with your own keys if required"
7+
openssl req -new -x509 -days 3650 -nodes -out /config/keys/cert.crt -keyout /config/keys/cert.key -subj "$SUBJECT"
88
fi
9-
10-

root/etc/services.d/nginx/run

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#!/usr/bin/with-contenv bash
22

33
if pgrep -f "[n]ginx:" > /dev/null; then
4-
echo "Zombie nginx processes detected, sending SIGTERM"
5-
pkill -ef [n]ginx:
6-
sleep 1
4+
echo "Zombie nginx processes detected, sending SIGTERM"
5+
pkill -ef [n]ginx:
6+
sleep 1
77
fi
88

99
if pgrep -f "[n]ginx:" > /dev/null; then
10-
echo "Zombie nginx processes still active, sending SIGKILL"
11-
pkill -9 -ef [n]ginx:
12-
sleep 1
10+
echo "Zombie nginx processes still active, sending SIGKILL"
11+
pkill -9 -ef [n]ginx:
12+
sleep 1
1313
fi
1414

1515
exec /usr/sbin/nginx -c /config/nginx/nginx.conf

0 commit comments

Comments
 (0)