Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@ FROM ghcr.io/linuxserver/baseimage-alpine:3.13

# install packages
RUN \
echo "**** install build packages ****" && \
apk add --no-cache \
apache2-utils \
git \
libressl3.1-libssl \
logrotate \
nano \
nginx \
openssl \
php7 \
php7-fileinfo \
php7-fpm \
php7-json \
php7-mbstring \
php7-openssl \
php7-session \
php7-simplexml \
php7-xml \
php7-xmlwriter \
php7-zlib && \
echo "**** configure nginx ****" && \
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
/etc/nginx/fastcgi_params && \
rm -f /etc/nginx/conf.d/default.conf && \
echo "**** fix logrotate ****" && \
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
/etc/periodic/daily/logrotate
echo "**** install build packages ****" && \
apk add --no-cache \
apache2-utils \
git \
libressl3.1-libssl \
logrotate \
nano \
nginx \
openssl \
php7 \
php7-fileinfo \
php7-fpm \
php7-json \
php7-mbstring \
php7-openssl \
php7-session \
php7-simplexml \
php7-xml \
php7-xmlwriter \
php7-zlib && \
echo "**** configure nginx ****" && \
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
/etc/nginx/fastcgi_params && \
rm -f /etc/nginx/http.d/default.conf && \
echo "**** fix logrotate ****" && \
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
/etc/periodic/daily/logrotate

# add local files
COPY root/ /
Expand Down
56 changes: 28 additions & 28 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@ FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.13

# install packages
RUN \
echo "**** install build packages ****" && \
apk add --no-cache \
apache2-utils \
git \
libressl3.1-libssl \
logrotate \
nano \
nginx \
openssl \
php7 \
php7-fileinfo \
php7-fpm \
php7-json \
php7-mbstring \
php7-openssl \
php7-session \
php7-simplexml \
php7-xml \
php7-xmlwriter \
php7-zlib && \
echo "**** configure nginx ****" && \
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
/etc/nginx/fastcgi_params && \
rm -f /etc/nginx/conf.d/default.conf && \
echo "**** fix logrotate ****" && \
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
/etc/periodic/daily/logrotate
echo "**** install build packages ****" && \
apk add --no-cache \
apache2-utils \
git \
libressl3.1-libssl \
logrotate \
nano \
nginx \
openssl \
php7 \
php7-fileinfo \
php7-fpm \
php7-json \
php7-mbstring \
php7-openssl \
php7-session \
php7-simplexml \
php7-xml \
php7-xmlwriter \
php7-zlib && \
echo "**** configure nginx ****" && \
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
/etc/nginx/fastcgi_params && \
rm -f /etc/nginx/http.d/default.conf && \
echo "**** fix logrotate ****" && \
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
/etc/periodic/daily/logrotate

# add local files
COPY root/ /
Expand Down
56 changes: 28 additions & 28 deletions Dockerfile.armhf
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@ FROM ghcr.io/linuxserver/baseimage-alpine:arm32v7-3.13

# install packages
RUN \
echo "**** install build packages ****" && \
apk add --no-cache \
apache2-utils \
git \
libressl3.1-libssl \
logrotate \
nano \
nginx \
openssl \
php7 \
php7-fileinfo \
php7-fpm \
php7-json \
php7-mbstring \
php7-openssl \
php7-session \
php7-simplexml \
php7-xml \
php7-xmlwriter \
php7-zlib && \
echo "**** configure nginx ****" && \
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
/etc/nginx/fastcgi_params && \
rm -f /etc/nginx/conf.d/default.conf && \
echo "**** fix logrotate ****" && \
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
/etc/periodic/daily/logrotate
echo "**** install build packages ****" && \
apk add --no-cache \
apache2-utils \
git \
libressl3.1-libssl \
logrotate \
nano \
nginx \
openssl \
php7 \
php7-fileinfo \
php7-fpm \
php7-json \
php7-mbstring \
php7-openssl \
php7-session \
php7-simplexml \
php7-xml \
php7-xmlwriter \
php7-zlib && \
echo "**** configure nginx ****" && \
echo 'fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> \
/etc/nginx/fastcgi_params && \
rm -f /etc/nginx/http.d/default.conf && \
echo "**** fix logrotate ****" && \
sed -i "s#/var/log/messages {}.*# #g" /etc/logrotate.conf && \
sed -i 's#/usr/sbin/logrotate /etc/logrotate.conf#/usr/sbin/logrotate /etc/logrotate.conf -s /config/log/logrotate.status#g' \
/etc/periodic/daily/logrotate

# add local files
COPY root/ /
Expand Down
4 changes: 0 additions & 4 deletions root/defaults/default
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ server {

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;

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

user abc;
worker_processes 4;
Expand Down Expand Up @@ -72,31 +72,9 @@ http {
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/http.d/*.conf;
include /config/nginx/site-confs/*;

}


#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
daemon off;

31 changes: 18 additions & 13 deletions root/etc/cont-init.d/20-config
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

# make our folders
mkdir -p \
/config/{nginx/site-confs,www,log/nginx,keys,log/php,php} \
/run \
/var/lib/nginx/tmp/client_body \
/var/tmp/nginx
/config/{nginx/site-confs,www,log/nginx,keys,log/php,php} \
/run \
/var/lib/nginx/tmp/client_body \
/var/tmp/nginx

# copy config files
[[ ! -f /config/nginx/nginx.conf ]] && \
cp /defaults/nginx.conf /config/nginx/nginx.conf
cp /defaults/nginx.conf /config/nginx/nginx.conf
[[ ! -f /config/nginx/site-confs/default ]] && \
cp /defaults/default /config/nginx/site-confs/default
cp /defaults/default /config/nginx/site-confs/default
[[ $(find /config/www -type f | wc -l) -eq 0 ]] && \
cp /defaults/index.html /config/www/index.html
cp /defaults/index.html /config/www/index.html

# create local php.ini if it doesn't exist, set local timezone
[[ ! -f /config/php/php-local.ini ]] && \
printf "; Edit this file to override php.ini directives and restart the container\\n\\ndate.timezone = %s\\n" "$TZ" > /config/php/php-local.ini
printf "; Edit this file to override php.ini directives and restart the container\\n\\ndate.timezone = %s\\n" "$TZ" > /config/php/php-local.ini
# copy user php-local.ini to image
cp /config/php/php-local.ini /etc/php7/conf.d/php-local.ini
#fix php-fpm log location
Expand All @@ -27,15 +27,20 @@ sed -i "s#user = nobody.*#user = abc#g" /etc/php7/php-fpm.d/www.conf
sed -i "s#group = nobody.*#group = abc#g" /etc/php7/php-fpm.d/www.conf
# create override for www.conf if it doesn't exist
[[ ! -f /config/php/www2.conf ]] && \
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
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
# copy user www2.conf to image
cp /config/php/www2.conf /etc/php7/php-fpm.d/www2.conf

# backwards compatibility for alpine >=3.14
if [ ! -e /etc/nginx/conf.d ]; then
ln -s /etc/nginx/http.d /etc/nginx/conf.d
fi

# permissions
chown -R abc:abc \
/config \
/var/lib/nginx \
/var/tmp/nginx
/config \
/var/lib/nginx \
/var/tmp/nginx
chmod -R g+w \
/config/{nginx,www}
/config/{nginx,www}
chmod -R 644 /etc/logrotate.d
8 changes: 3 additions & 5 deletions root/etc/cont-init.d/30-keygen
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/with-contenv bash
SUBJECT="/C=US/ST=CA/L=Carlsbad/O=Linuxserver.io/OU=LSIO Server/CN=*"
if [[ -f /config/keys/cert.key && -f /config/keys/cert.crt ]]; then
echo "using keys found in /config/keys"
echo "using keys found in /config/keys"
else
echo "generating self-signed keys in /config/keys, you can replace these with your own keys if required"
openssl req -new -x509 -days 3650 -nodes -out /config/keys/cert.crt -keyout /config/keys/cert.key -subj "$SUBJECT"
echo "generating self-signed keys in /config/keys, you can replace these with your own keys if required"
openssl req -new -x509 -days 3650 -nodes -out /config/keys/cert.crt -keyout /config/keys/cert.key -subj "$SUBJECT"
fi


12 changes: 6 additions & 6 deletions root/etc/services.d/nginx/run
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/with-contenv bash

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

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

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