8. Servidor nextcloud
Note
Servicio de ficheros compartidos
1dnf install unzip wget
2dnf install php-gd php-pecl-zip unzip php php-fpm php-mysqlnd php-odbc php-ldap
3dnf install nginx
4dnf install cifs-utils
Directorio de trabajo /opt/nextcloud
Descargar en fichero zip de la web oficial.
1wget https://nextcloud...
Descomprimir en fichero en el directorio de trabajo.
1unzip <nombre-fichero>.zip
Configurar la conexión a la base de datos y el directorio de ficheros en el fichero config/config.php.
1'datadirectory' => '/media/nextcloud/data', 2'dbtype' => 'mysql', 3'version' => '29.0.2.2', 4'overwrite.cli.url' => 'http://172.16.1.11/nextcloud', 5'dbname' => 'nextcloudv2', 6'dbhost' => 'database', 7'dbport' => '', 8'dbtableprefix' => 'oc_', 9'mysql.utf8mb4' => true, 10'dbuser' => 'nextcloudv2', 11'dbpassword' => '******',*
Configurar el cliente samba en /etc/systemd/system/nextcloud.service para el usuario
nginx
.1[Unit] 2Description=Resources Service 3Wants=network-online.target 4After=network-online.target 5 6[Service] 7Type=forking 8ExecStart=/usr/bin/mount -t cifs //samba/nextcloud /media/nextcloud \ 9 -o username=diego,password=******, \ 10 uid=993, gid=993, dir_mode=0770 11 12[Install] 13WantedBy=multi-user.target
Configurar php
Con la instalación es suficiente. Para posibles modificaciones /etc/php-fpm.d/www.conf.
Configurar nginx
Linea 45: ruta de netxcloudLínea 65: configuración de PHP1http { 2 include mime.types; 3 default_type application/octet-stream; 4 5 sendfile on; 6 keepalive_timeout 65; 7 8 server { 9 listen 80; 10 listen [::]:80; 11 server_name _default; 12 13 root /opt; 14 server_tokens off; 15 16 client_max_body_size 512M; 17 client_body_timeout 300s; 18 fastcgi_buffers 64 4K; 19 20 index index.php index.html /index.php$request_uri; 21 22 location ^~ /nextcloud { 23 client_max_body_size 512M; 24 client_body_timeout 300s; 25 client_body_buffer_size 512k; 26 fastcgi_buffers 64 4K; 27 28 gzip on; 29 gzip_vary on; 30 gzip_comp_level 4; 31 gzip_min_length 256; 32 gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; 33 gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; 34 35 add_header Referrer-Policy "no-referrer" always; 36 add_header X-Content-Type-Options "nosniff" always; 37 add_header X-Frame-Options "SAMEORIGIN" always; 38 add_header X-Permitted-Cross-Domain-Policies "none" always; 39 add_header X-Robots-Tag "noindex, nofollow" always; 40 add_header X-XSS-Protection "1; mode=block" always; 41 42 # Remove X-Powered-By, which is an information leak 43 fastcgi_hide_header X-Powered-By; 44 index index.php index.html /nextcloud/index.php$request_uri; 45 46 # Rules borrowed from `.htaccess` to hide certain paths from clients 47 location ~ ^/nextcloud/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; } 48 location ~ ^/nextcloud/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; } 49 50 location ~ \.php(?:$|/) { 51 # Required for legacy support 52 rewrite ^/nextcloud/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode(_arm64)?\/proxy) /nextcloud/index.php$request_uri; 53 54 fastcgi_split_path_info ^(.+?\.php)(/.*)$; 55 set $path_info $fastcgi_path_info; 56 57 try_files $fastcgi_script_name =404; 58 59 include fastcgi_params; 60 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 61 fastcgi_param PATH_INFO $path_info; 62 63 fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice 64 fastcgi_param front_controller_active true; # Enable pretty urls 65 fastcgi_pass unix:/run/php-fpm/www.sock; 66 67 fastcgi_intercept_errors on; 68 fastcgi_request_buffering off; 69 70 fastcgi_max_temp_file_size 0; 71 } 72 73 # Serve static files 74 location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ { 75 try_files $uri /nextcloud/index.php$request_uri; 76 # HTTP response headers borrowed from Nextcloud `.htaccess` 77 add_header Referrer-Policy "no-referrer" always; 78 add_header X-Content-Type-Options "nosniff" always; 79 add_header X-Frame-Options "SAMEORIGIN" always; 80 add_header X-Permitted-Cross-Domain-Policies "none" always; 81 add_header X-Robots-Tag "noindex, nofollow" always; 82 add_header X-XSS-Protection "1; mode=block" always; 83 access_log off; # Optional: Don't log access to assets 84 } 85 86 location ~ \.woff2?$ { 87 try_files $uri /nextcloud/index.php$request_uri; 88 expires 7d; # Cache-Control policy borrowed from `.htaccess` 89 access_log off; # Optional: Don't log access to assets 90 } 91 92 # Rule borrowed from `.htaccess` 93 location /nextcloud/remote { 94 return 301 /nextcloud/remote.php$request_uri; 95 } 96 97 location /nextcloud { 98 try_files $uri $uri/ /nextcloud/index.php$request_uri; 99 } 100 } 101 } 102}