Skip to main content

Nextcloud

Dépendances

Environnement : Arch Linux + Caddy

  1. Installation des dépendances
    pacman -Sy php php-fpm php-apcu php-gd php-imagick
    
  2. Configuration de php (/etc/php/php.ini)
    [PHP]
    memory_limit = 512M
    
    ; Extensions
    extension=bcmath
    extension=bz2
    extension=curl
    extension=exif
    extension=gd
    extension=gmp
    extension=iconv
    extension=intl
    zend_extension=opcache
    extension=pdo_mysql
    extension=sysvsem
    extension=zip
    
    [opcache]
    opcache.enable=1
    opcache.memory_consumption=256
    opcache.interned_strings_buffer=32
    opcache.max_accelerated_files=10000
    opcache.revalidate_freq=2
    opcache.save_comments=1
    
  3. Enable imagick extension (/etc/php/conf.d/imagick.ini)
    extension = imagick
    
  4. Enable apcu extension (/etc/php/conf.d/apcu.ini)
    extension=apcu.so
    apc.enable_cli=1
    apc.ttl=7200
    
  5. Configure php-fpm (/etc/php/php-fpm.d/www.conf)
    env[PATH] = /usr/local/bin:/usr/bin:/bin
    

Configuration reverse proxy

cloud.bksp.space {
	root * /srv/http/cloud.bksp.space
	php_fastcgi unix//run/php-fpm/php-fpm.sock
	log {
		output file /var/log/caddy/cloud.bksp.space.log
	}
	file_server
	encode gzip
	
	handle_errors {
		respond "{err.status_code} {err.status_text}" {err.status_code}
	}

	@disallowed {
		path /build/*
		path /tests/*
		path /config/*
		path /lib/*
		path /3rdparty/*
		path /templates/*
		path /data/*
		path .*
		path /autotest*
		path /occ*
		path /issue*
		path /indie*
		path /db_*
		path /console*
	}
	
	handle @disallowed {
		error 404
	}

	redir /.well-known/carddav /remote.php/dav 301
	redir /.well-known/caldav /remote.php/dav 301

	header {
        # enable HSTS
		Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;"
    }
	
	@static path_regexp \.(?:css|js|svg|gif)$
	handle @static {
		# 6 months
		header Cache-Control max-age=15552000
	}
	@fonts path *.woff2
	handle @fonts {
		# 7 days
		header Cache-Control max-age=604800
	}
}