Skip to content

Commit b9c6d36

Browse files
authored
Merge pull request #87 from thelamer/master
adding new deps and updating nginx config for version 15
2 parents 5088084 + 39fd8e3 commit b9c6d36

5 files changed

Lines changed: 98 additions & 117 deletions

File tree

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ENV NEXTCLOUD_PATH="/config/www/nextcloud"
1212

1313
RUN \
1414
echo "**** install build packages ****" && \
15-
apk add --no-cache --virtual=build-dependencies \
15+
apk add --no-cache --virtual=build-dependencies --upgrade \
1616
autoconf \
1717
automake \
1818
file \
@@ -24,7 +24,7 @@ RUN \
2424
samba-dev \
2525
zlib-dev && \
2626
echo "**** install runtime packages ****" && \
27-
apk add --no-cache \
27+
apk add --no-cache --upgrade \
2828
curl \
2929
ffmpeg \
3030
imagemagick \
@@ -54,10 +54,11 @@ RUN \
5454
php7-phar \
5555
php7-posix \
5656
php7-redis \
57+
php7-sodium \
5758
php7-sqlite3 \
5859
php7-xmlreader \
5960
php7-zip \
60-
samba \
61+
samba-client \
6162
sudo \
6263
tar \
6364
unzip && \
@@ -71,6 +72,7 @@ RUN \
7172
make install && \
7273
echo "**** configure php and nginx for nextcloud ****" && \
7374
echo "extension="smbclient.so"" > /etc/php7/conf.d/00_smbclient.ini && \
75+
echo 'apc.enable_cli=1' >> /etc/php7/conf.d/apcu.ini && \
7476
sed -i \
7577
-e 's/;opcache.enable.*=.*/opcache.enable=1/g' \
7678
-e 's/;opcache.interned_strings_buffer.*=.*/opcache.interned_strings_buffer=8/g' \

Dockerfile.aarch64

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ENV NEXTCLOUD_PATH="/config/www/nextcloud"
1515

1616
RUN \
1717
echo "**** install build packages ****" && \
18-
apk add --no-cache --virtual=build-dependencies \
18+
apk add --no-cache --virtual=build-dependencies --upgrade \
1919
autoconf \
2020
automake \
2121
file \
@@ -27,7 +27,7 @@ RUN \
2727
samba-dev \
2828
zlib-dev && \
2929
echo "**** install runtime packages ****" && \
30-
apk add --no-cache \
30+
apk add --no-cache --upgrade \
3131
curl \
3232
ffmpeg \
3333
imagemagick \
@@ -57,10 +57,11 @@ RUN \
5757
php7-phar \
5858
php7-posix \
5959
php7-redis \
60+
php7-sodium \
6061
php7-sqlite3 \
6162
php7-xmlreader \
6263
php7-zip \
63-
samba \
64+
samba-client \
6465
sudo \
6566
tar \
6667
unzip && \
@@ -74,6 +75,7 @@ RUN \
7475
make install && \
7576
echo "**** configure php and nginx for nextcloud ****" && \
7677
echo "extension="smbclient.so"" > /etc/php7/conf.d/00_smbclient.ini && \
78+
echo 'apc.enable_cli=1' >> /etc/php7/conf.d/apcu.ini && \
7779
sed -i \
7880
-e 's/;opcache.enable.*=.*/opcache.enable=1/g' \
7981
-e 's/;opcache.interned_strings_buffer.*=.*/opcache.interned_strings_buffer=8/g' \

Dockerfile.armhf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ENV NEXTCLOUD_PATH="/config/www/nextcloud"
1515

1616
RUN \
1717
echo "**** install build packages ****" && \
18-
apk add --no-cache --virtual=build-dependencies \
18+
apk add --no-cache --virtual=build-dependencies --upgrade \
1919
autoconf \
2020
automake \
2121
file \
@@ -27,7 +27,7 @@ RUN \
2727
samba-dev \
2828
zlib-dev && \
2929
echo "**** install runtime packages ****" && \
30-
apk add --no-cache \
30+
apk add --no-cache --upgrade \
3131
curl \
3232
ffmpeg \
3333
imagemagick \
@@ -57,10 +57,11 @@ RUN \
5757
php7-phar \
5858
php7-posix \
5959
php7-redis \
60+
php7-sodium \
6061
php7-sqlite3 \
6162
php7-xmlreader \
6263
php7-zip \
63-
samba \
64+
samba-client \
6465
sudo \
6566
tar \
6667
unzip && \
@@ -74,6 +75,7 @@ RUN \
7475
make install && \
7576
echo "**** configure php and nginx for nextcloud ****" && \
7677
echo "extension="smbclient.so"" > /etc/php7/conf.d/00_smbclient.ini && \
78+
echo 'apc.enable_cli=1' >> /etc/php7/conf.d/apcu.ini && \
7779
sed -i \
7880
-e 's/;opcache.enable.*=.*/opcache.enable=1/g' \
7981
-e 's/;opcache.interned_strings_buffer.*=.*/opcache.interned_strings_buffer=8/g' \

root/defaults/default

Lines changed: 73 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,84 @@
11
upstream php-handler {
2-
server 127.0.0.1:9000;
3-
# server unix:/var/run/php/php7.0-fpm.sock;
2+
server 127.0.0.1:9000;
43
}
5-
64
server {
7-
listen 80;
8-
server_name _;
9-
# enforce https
10-
return 301 https://$server_name$request_uri;
5+
listen 80;
6+
listen [::]:80;
7+
server_name _;
8+
return 301 https://$server_name$request_uri;
119
}
12-
1310
server {
14-
listen 443 ssl;
15-
server_name _;
16-
17-
ssl_certificate /config/keys/cert.crt;
18-
ssl_certificate_key /config/keys/cert.key;
19-
20-
# Add headers to serve security related headers
21-
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
22-
add_header X-Content-Type-Options nosniff;
23-
# add_header X-Frame-Options "SAMEORIGIN";
24-
add_header X-XSS-Protection "1; mode=block";
25-
add_header X-Robots-Tag none;
26-
add_header X-Download-Options noopen;
27-
add_header X-Permitted-Cross-Domain-Policies none;
28-
add_header Referrer-Policy no-referrer always;
29-
30-
# Path to the root of your installation
31-
root /config/www/nextcloud/;
32-
# set max upload size
33-
client_max_body_size 10G;
34-
fastcgi_buffers 64 4K;
35-
36-
# Disable gzip to avoid the removal of the ETag header
37-
gzip off;
38-
39-
# Uncomment if your server is build with the ngx_pagespeed module
40-
# This module is currently not supported.
41-
#pagespeed off;
42-
43-
index index.php;
44-
error_page 403 /core/templates/403.php;
45-
error_page 404 /core/templates/404.php;
46-
47-
rewrite ^/.well-known/carddav /remote.php/dav/ permanent;
48-
rewrite ^/.well-known/caldav /remote.php/dav/ permanent;
49-
50-
# The following 2 rules are only needed for the user_webfinger app.
51-
# Uncomment it if you're planning to use this app.
52-
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
53-
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
54-
55-
location = /robots.txt {
56-
allow all;
57-
log_not_found off;
58-
access_log off;
59-
}
60-
61-
location ~ ^/(build|tests|config|lib|3rdparty|templates|data)/ {
62-
deny all;
63-
}
64-
65-
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
66-
deny all;
67-
}
68-
69-
location / {
70-
71-
rewrite ^/remote/(.*) /remote.php last;
72-
73-
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
74-
75-
try_files $uri $uri/ =404;
76-
}
77-
78-
location ~ \.php(?:$|/) {
79-
fastcgi_split_path_info ^(.+\.php)(/.+)$;
80-
include /etc/nginx/fastcgi_params;
81-
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
82-
fastcgi_param PATH_INFO $fastcgi_path_info;
83-
fastcgi_param HTTPS on;
84-
fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
85-
fastcgi_pass php-handler;
86-
fastcgi_intercept_errors on;
87-
}
88-
89-
# Adding the cache control header for js and css files
90-
# Make sure it is BELOW the location ~ \.php(?:$|/) { block
91-
location ~* \.(?:css|js)$ {
92-
add_header Cache-Control "public, max-age=7200";
93-
# Add headers to serve security related headers
94-
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
11+
listen 443 ssl http2;
12+
listen [::]:443 ssl http2;
13+
server_name _;
14+
ssl_certificate /config/keys/cert.crt;
15+
ssl_certificate_key /config/keys/cert.key;
9516
add_header X-Content-Type-Options nosniff;
96-
add_header X-Frame-Options "SAMEORIGIN";
9717
add_header X-XSS-Protection "1; mode=block";
9818
add_header X-Robots-Tag none;
9919
add_header X-Download-Options noopen;
10020
add_header X-Permitted-Cross-Domain-Policies none;
101-
add_header Referrer-Policy no-referrer always;
102-
# Optional: Don't log access to assets
103-
access_log off;
104-
}
105-
106-
# Optional: Don't log access to other assets
107-
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$ {
108-
access_log off;
109-
}
21+
add_header Referrer-Policy no-referrer;
22+
fastcgi_hide_header X-Powered-By;
23+
root /config/www/nextcloud/;
24+
location = /robots.txt {
25+
allow all;
26+
log_not_found off;
27+
access_log off;
28+
}
29+
location = /.well-known/carddav {
30+
return 301 $scheme://$host/remote.php/dav;
31+
}
32+
location = /.well-known/caldav {
33+
return 301 $scheme://$host/remote.php/dav;
34+
}
35+
client_max_body_size 10G;
36+
fastcgi_buffers 64 4K;
37+
gzip on;
38+
gzip_vary on;
39+
gzip_comp_level 4;
40+
gzip_min_length 256;
41+
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
42+
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
43+
location / {
44+
rewrite ^ /index.php$request_uri;
45+
}
46+
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
47+
deny all;
48+
}
49+
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
50+
deny all;
51+
}
52+
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|ocm-provider\/.+)\.php(?:$|\/) {
53+
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
54+
include /etc/nginx/fastcgi_params;
55+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
56+
fastcgi_param PATH_INFO $fastcgi_path_info;
57+
fastcgi_param HTTPS on;
58+
fastcgi_param modHeadersAvailable true;
59+
fastcgi_param front_controller_active true;
60+
fastcgi_pass php-handler;
61+
fastcgi_intercept_errors on;
62+
fastcgi_request_buffering off;
63+
}
64+
65+
location ~ ^\/(?:updater|ocs-provider|ocm-provider)(?:$|\/) {
66+
try_files $uri/ =404;
67+
index index.php;
68+
}
69+
location ~ \.(?:css|js|woff2?|svg|gif)$ {
70+
try_files $uri /index.php$request_uri;
71+
add_header Cache-Control "public, max-age=15778463";
72+
add_header X-Content-Type-Options nosniff;
73+
add_header X-XSS-Protection "1; mode=block";
74+
add_header X-Robots-Tag none;
75+
add_header X-Download-Options noopen;
76+
add_header X-Permitted-Cross-Domain-Policies none;
77+
add_header Referrer-Policy no-referrer;
78+
access_log off;
79+
}
80+
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
81+
try_files $uri /index.php$request_uri;
82+
access_log off;
83+
}
11084
}

root/etc/cont-init.d/50-install

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ mkdir -p \
66

77
# install app
88
if [ ! -e "${NEXTCLOUD_PATH}/index.php" ]; then
9-
NEXTCLOUD_VERSION=$(cat /version.txt)
10-
curl -o /tmp/nextcloud.tar.bz2 -L \
11-
https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2
12-
tar xf /tmp/nextcloud.tar.bz2 -C \
13-
"${NEXTCLOUD_PATH}" --strip-components=1
14-
rm -f \
15-
/tmp/nextcloud.tar.bz2
16-
chown abc:abc -R \
17-
"${NEXTCLOUD_PATH}"
9+
NEXTCLOUD_VERSION=$(cat /version.txt)
10+
curl -o /tmp/nextcloud.tar.bz2 -L \
11+
https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2
12+
tar xf /tmp/nextcloud.tar.bz2 -C \
13+
"${NEXTCLOUD_PATH}" --strip-components=1
14+
rm -f \
15+
/tmp/nextcloud.tar.bz2
16+
chown abc:abc -R \
17+
"${NEXTCLOUD_PATH}"
18+
chmod +x "${NEXTCLOUD_PATH}/occ"
1819
fi
1920

2021
# set cronjob

0 commit comments

Comments
 (0)