65 lines
2.4 KiB
Nix
65 lines
2.4 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
{
|
|
services.nginx.virtualHosts."cloud.stubbe.rocks" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
root = /etc/per-user-pkgs/nextcloud;
|
|
#locations."/".proxyPass = "http://unix:/run/phpfpm/nextcloud.sock";
|
|
# Path to the root of your installation
|
|
locations."/robots.txt".extraConfig = ''
|
|
allow all;
|
|
log_not_found off;
|
|
access_log off;
|
|
'';
|
|
|
|
locations."/.well-known/carddav".extraConfig = "return 301 $scheme://$host/remote.php/dav;";
|
|
locations."/.well-known/caldav".extraConfig = "return 301 $scheme://$host/remote.php/dav;";
|
|
locations."/" = "rewrite ^ /index.php$uri;";
|
|
locations."~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/" = "deny all;";
|
|
locations."~ ^/(?:\.|autotest|occ|issue|indie|db_|console)" = "deny all;";
|
|
locations."~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/)" =''
|
|
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
|
include fastcgi_params;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
fastcgi_param HTTPS on;
|
|
#Avoid sending the security headers twice
|
|
fastcgi_param modHeadersAvailable true;
|
|
fastcgi_param front_controller_active true;
|
|
fastcgi_pass php-handler;
|
|
fastcgi_intercept_errors on;
|
|
fastcgi_request_buffering off;
|
|
'';
|
|
|
|
locations."~ ^/(?:updater|ocs-provider)(?:$|/)" = ''
|
|
try_files $uri/ =404;
|
|
index index.php;
|
|
'';
|
|
locations."~ \.(?:png|html|ttf|ico|jpg|jpeg)$" = ''
|
|
try_files $uri /index.php$uri$is_args$args;
|
|
# Optional: Don't log access to other assets
|
|
access_log off;
|
|
'';
|
|
};
|
|
|
|
users.extraUsers.nextcloud.packages = [pkgs.nextcloud];
|
|
|
|
services.phpfpm.poolConfigs = {
|
|
nextcloud = ''
|
|
listen = /run/phpfpm/nextcloud.sock
|
|
listen.group = nginx
|
|
user = nextcloud
|
|
group = nextcloud
|
|
pm = dynamic
|
|
pm.max_children = 75
|
|
pm.start_servers = 10
|
|
pm.min_spare_servers = 5
|
|
pm.max_spare_servers = 20
|
|
pm.max_requests = 500
|
|
'';
|
|
};
|
|
|
|
services.nginx.upstreams.php-handler.servers = ["unix:/run/php-fpm/php-fpm.sock"];
|
|
}
|