Skip to content

Commit

Permalink
nextcloud: Move PHP configurations to files
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo1003 committed Jan 7, 2024
1 parent 08d715e commit 77b3a55
Show file tree
Hide file tree
Showing 5 changed files with 508 additions and 24 deletions.
28 changes: 4 additions & 24 deletions nextcloud/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,12 @@ RUN set -ex; \
WORKDIR /var/www/html

# set recommended PHP.ini settings
# see https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/server_tuning.html#enable-php-opcache
# see https://docs.nextcloud.com/server/stable/admin_manual/installation/server_tuning.html#enable-php-opcache
ENV PHP_MEMORY_LIMIT=512M
ENV PHP_UPLOAD_LIMIT=1024M
RUN { \
echo 'opcache.enable=1'; \
echo 'opcache.interned_strings_buffer=64'; \
echo 'opcache.max_accelerated_files=10000'; \
echo 'opcache.memory_consumption=256'; \
echo 'opcache.save_comments=1'; \
echo 'opcache.revalidate_freq=60'; \
} > /etc/php82/conf.d/opcache-recommended.ini; \
\
echo 'apc.enable_cli=1' >> /etc/php82/conf.d/php-ext-apcu.ini; \
\
{ \
echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \
echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \
echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \
} > /etc/php82/conf.d/nextcloud.ini; \
\
sed -i 's/;catch_workers_output = yes/catch_workers_output = yes/;s/;decorate_workers_output = no/decorate_workers_output = no/' /etc/php82/php-fpm.d/www.conf; \
sed -i 's/user = .*/user = www-data/;s/group = .*/group = www-data/' /etc/php82/php-fpm.d/www.conf; \
sed -i 's/pm.max_children = .*/pm.max_children = 8/' /etc/php82/php-fpm.d/www.conf; \
sed -i 's|;error_log = log/php82/error.log|error_log = /proc/self/fd/2|' /etc/php82/php-fpm.conf; \
sed -i 's/;clear_env = .*/clear_env = no/g' /etc/php82/php-fpm.d/www.conf; \
rm /var/spool/cron/crontabs/root; \
COPY php.conf.d/ /etc/php82/conf.d/
COPY php-fpm.d/ /etc/php82/php-fpm.d/
RUN rm /var/spool/cron/crontabs/root; \
echo '*/5 * * * * php82 -f /var/www/html/cron.php' > /var/spool/cron/crontabs/www-data; \
\
chown -R www-data:www-data /var/www; \
Expand Down
Loading

0 comments on commit 77b3a55

Please sign in to comment.