Skip to content

Instantly share code, notes, and snippets.

@wolegis
Last active February 5, 2024 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolegis/fc0c01882b694777a6565aa1d0a4da47 to your computer and use it in GitHub Desktop.
Save wolegis/fc0c01882b694777a6565aa1d0a4da47 to your computer and use it in GitHub Desktop.
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-legacy/modules:/var/log/%n:/proc/meminfo:/proc/cpuinfo
# 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=512M
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=16
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
php-set = apc.ttl=7200
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
php-set = extension=iconv
# uncomment if php-imagick is installed and used
php-set = extension=imagick
# recommended to enable
php-set = extension=intl
# 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 depending on what database is used
php-set = extension=pdo_mysql
# php-set = extension=pdo_pgsql
# php-set = extension=pdo_sqlite
# uncomment if php-igbinary is installed and used (e.g. required by redis)
# php-set = extension=igbinary
# uncomment if php-redis is installed and used (requires php-igbinary)
# php-set = extension=redis
# sodium for the argon2 hashing algorithm
php-set = extension=sodium
# sysvsem required since nextcloud 26
php-set = extension=sysvsem
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment