Skip to content

Instantly share code, notes, and snippets.

@wolegis
Last active Apr 17, 2022
Embed
What would you like to do?
uWSGI config file for Nextcloud
[uwsgi]
# (optional) makes Nextcloud process(es) spawned by uWSGI more recognizable as uWSGI sub-processes
# procname-master = %n
procname-master = uwsgi %n
master = true
plugins = php
# hack to work around a uWSGI bug that renders opcache dysfunctional (see uWSGI docs)
php-sapi-name = apache
# make location of uWSGI socket compatible with systemd unit files for uWSGI
# socket = /run/%n/%n.sock
# (see /usr/lib/systemd/system/uwsgi@.socket)
socket = /run/uwsgi/%n.sock
# uncomment for a stats socket, that can be used with uwsgitop
# stats = /run/%n/%n-stats.sock
# relocate statistics socket accordingly
# stats = /run/uwsgi/%n-stats.sock
# cleanup sockets when uWSGI terminates
vacuum = true
uid = nextcloud
gid = nextcloud
# make sockets read-/writeable only by user nextcloud and web server
chown-socket = %(uid):http
chmod-socket = 660
# files created by Nextcloud code only writeable by user nextcloud
umask = 022
# number of workers is adapted dynamically. no need to run more than one worker when idle
cheaper = 1
processes = 10
# cheaper = 4
cheaper-step = 1
idle = 600
die-on-idle = true
# reload whenever this config file changes
touch-reload = %p
# request logging is usually already done by the web server
disable-logging = true
# custom parameters are difficult to distinguish from real config parameters
# and not really needed anyway
# cloud_data_dir = /var/lib/nextcloud/data
# cloud_writable_apps_dir = /var/lib/nextcloud/apps
chdir = /var/lib/nextcloud/data
php-allowed-ext = .php
php-docroot = /usr/share/webapps/%n
php-index = index.php
# adapt time zone to your needs
php-set = date.timezone=Europe/Berlin
# remove %(cloud_data_dir):%(cloud_writeable_apps_dir) as already covered by
# /var/lib/%n. remove redis socket in case redis is not used.
# /var/log/%n/%n.log is not a directory. replace by /var/log/%n
php-set = open_basedir=/var/lib/%n:/tmp:/usr/share/webapps/%n:/etc/webapps/%n:/dev/urandom:/usr/lib/php/modules:/var/log/%n:/proc/meminfo
# put session data in dedicated directory
# php-set = session.save_path=/tmp
php-set = session.save_path=/var/lib/%n/sessions
php-set = session.gc_maxlifetime=21600
php-set = session.gc_divisor=500
php-set = session.gc_probability=1
php-set = expose_php=false
php-set = post_max_size=1000M
php-set = upload_max_filesize=1000M
# as recommended in admin manual (avoids related warning in admin GUI later)
php-set = output_buffering=off
php-set = max_input_time=120
php-set = max_execution_time=60
php-set = memory_limit=768M
php-set = zend_extension=opcache
php-set = opcache.enable=1
# remove (see https://github.com/nextcloud/server/pull/15468)
# php-set = opcache.enable_cli=1
php-set = opcache.interned_strings_buffer=8
php-set = opcache.max_accelerated_files=10000
php-set = opcache.memory_consumption=128
php-set = opcache.save_comments=1
php-set = opcache.revalidate_freq=1
# uncomment if php-apcu is installed and used
# php-set = extension=apcu
# (see https://github.com/krakjoe/apcu/blob/simplify/INSTALL)
php-set = apc.ttl=7200
php-set = apc.enable_cli=1
php-set = extension=bcmath
php-set = extension=bz2
# already enabled in standard php.ini. no need to enable it here again
# php-set = extension=curl
php-set = extension=exif
# extension ftp is very likely not used
# php-set = extension=ftp
php-set = extension=gd
php-set = extension=gmp
# uncomment if php-imagick is installed and used
php-set = extension=imagick
# uncomment if php-imap is installed and used
# php-set = extension=imap
# recommended to enable
php-set = extension=intl
php-set = extension=iconv
# extension ldap is very likely not used
# php-set = extension=ldap
# uncomment if php-memcached is installed and used
# php-set = extension=memcached
# uncomment exactly one of the pdo extensions
php-set = extension=pdo_mysql
# php-set = extension=pdo_pgsql
# php-set = extension=pdo_sqlite
# uncomment if php-igbinary is installed and used
# php-set = extension=igbinary
# uncomment if php-redis is installed and used (requires php-igbinary)
# php-set = extension=redis
# no docs anywhere that recommend this extension
# php-set = extension=sockets
# uncomment if php-xsl is installed and used
# php-set = extension=xsl
# already enabled in standard php.ini. no need to enable it here again
# php-set = extension=zip
# web server is already handling URL rewriting, so tell Nextcloud not to repeat this
env = front_controller_active=true
# we will do that with systemd timers
# change the URL to your own address and uncomment to run a webcron job every five minutes
# cron = -5 -1 -1 -1 -1 curl --silent https://change.me.tld/cron.php 1>/dev/null
# uncomment to run a cron job every five minutes
# cron = -5 -1 -1 -1 -1 php -f /usr/share/webapps/%n/cron.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment