Cambios para el documento Instalacion (docker)
Última modificación por dFa el 2025/02/24 10:01
Resumen
-
Propiedades de página (1 modificado, 0 añadido, 0 eliminado)
-
Adjuntos (0 modificado, 0 añadido, 3 eliminado)
Detalles
- Propiedades de página
-
- Contenido
-
... ... @@ -74,8 +74,6 @@ 74 74 MYSQL_PASSWORD: Ko5b0sq977j1saaCQ3SD55 75 75 REDIS_HOST: redis 76 76 PHP_UPLOAD_LIMIT: 0 77 - entrypoint: ["sh", "-c", "mkdir -p /var/nextcloud/data && chown -R www-data:www-data /var/nextcloud/data && chmod -R 770 /var/nextcloud/data && docker-php-entrypoint php-fpm"] 78 - 79 79 web: 80 80 image: nginx 81 81 container_name: nextcloud-web ... ... @@ -115,272 +115,18 @@ 115 115 116 116 Desplegamos los contenedores: 117 117 118 -[[image:1740216 653242-590.png]]116 +[[image:1740216587698-323.png]] 119 119 120 -Y vemos que se han creado los volumenes correctamente: 121 121 122 -[[image:1740216641833-376.png]] 123 123 124 -== Configuración == 120 + 121 +))) 125 125 126 -Con los volumenes creados, todavía nextcloud no es accesible, dado que debemos configurar tanto el config.php como como el nginx.conf. 127 127 128 -=== nginx.conf === 129 129 130 -El fichero nginx.conf se encuentra en el volumen nextcloud_nginx_conf. Realizamos previamente un backup y reemplazamos por el siguiente: 131 131 132 -{{code language="yaml"}} 133 -worker_processes auto; 134 - 135 -error_log /var/log/nginx/error.log warn; 136 -pid /var/run/nginx.pid; 137 - 138 -events { 139 - worker_connections 1024; 140 -} 141 - 142 -http { 143 - include mime.types; 144 - default_type application/octet-stream; 145 - types { 146 - text/javascript mjs; 147 - application/wasm wasm; 148 - } 149 - 150 - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 151 - '$status $body_bytes_sent "$http_referer" ' 152 - '"$http_user_agent" "$http_x_forwarded_for"'; 153 - 154 - access_log /var/log/nginx/access.log main; 155 - 156 - sendfile on; 157 - keepalive_timeout 65; 158 - 159 - # Define asset_immutable variable properly 160 - map $arg_v $asset_immutable { 161 - default ""; 162 - "" ", immutable"; 163 - } 164 - 165 - upstream php-handler { 166 - server app:9000; 167 - } 168 - 169 - server { 170 - listen 80; 171 - 172 - client_max_body_size 512M; 173 - client_body_timeout 300s; 174 - fastcgi_buffers 64 4K; 175 - 176 - client_body_buffer_size 512k; 177 - 178 - gzip on; 179 - gzip_vary on; 180 - gzip_comp_level 4; 181 - gzip_min_length 256; 182 - gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; 183 - 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; 184 - 185 - add_header Referrer-Policy "no-referrer" always; 186 - add_header X-Content-Type-Options "nosniff" always; 187 - add_header X-Frame-Options "SAMEORIGIN" always; 188 - add_header X-Permitted-Cross-Domain-Policies "none" always; 189 - add_header X-Robots-Tag "noindex, nofollow" always; 190 - add_header X-XSS-Protection "1; mode=block" always; 191 - 192 - fastcgi_hide_header X-Powered-By; 193 - 194 - root /var/www/html; 195 - 196 - index index.php index.html /index.php$request_uri; 197 - 198 - location = / { 199 - if ( $http_user_agent ~ ^DavClnt ) { 200 - return 302 /remote.php/webdav/$is_args$args; 201 - } 202 - } 203 - 204 - location = /robots.txt { 205 - allow all; 206 - log_not_found off; 207 - access_log off; 208 - } 209 - 210 - location ^~ /.well-known { 211 - location = /.well-known/carddav { return 301 /remote.php/dav/; } 212 - location = /.well-known/caldav { return 301 /remote.php/dav/; } 213 - location /.well-known/acme-challenge { try_files $uri $uri/ =404; } 214 - location /.well-known/pki-validation { try_files $uri $uri/ =404; } 215 - return 301 /index.php$request_uri; 216 - } 217 - 218 - location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; } 219 - location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; } 220 - 221 - location ~ \.php(?:$|/) { 222 - rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode(_arm64)?\/proxy) /index.php$request_uri; 223 - 224 - fastcgi_split_path_info ^(.+?\.php)(/.*)$; 225 - set $path_info $fastcgi_path_info; 226 - 227 - try_files $fastcgi_script_name =404; 228 - 229 - include fastcgi_params; 230 - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 231 - fastcgi_param PATH_INFO $path_info; 232 - fastcgi_param HTTPS on; 233 - 234 - fastcgi_param modHeadersAvailable true; 235 - fastcgi_param front_controller_active true; 236 - fastcgi_pass php-handler; 237 - 238 - fastcgi_intercept_errors on; 239 - fastcgi_request_buffering off; 240 - 241 - fastcgi_max_temp_file_size 0; 242 - } 243 - 244 - location ~ \.(?:css|js|mjs|svg|gif|ico|jpg|png|webp|wasm|tflite|map|ogg|flac)$ { 245 - try_files $uri /index.php$request_uri; 246 - add_header Cache-Control "public, max-age=15778463$asset_immutable"; 247 - access_log off; 248 - } 249 - 250 - location ~ \.wasm$ { 251 - default_type application/wasm; 252 - } 253 - 254 - location /remote { 255 - return 301 /remote.php$request_uri; 256 - } 257 - 258 - location / { 259 - try_files $uri $uri/ /index.php$request_uri; 260 - } 261 - } 262 -} 263 -{{/code}} 264 - 265 -=== config.php === 266 - 267 -Hacemos lo mismo con el fichero config.php que se encuentra en el volumen app dentro del directorio config: 268 - 269 -{{code language="php"}} 270 -<?php 271 -$CONFIG = array ( 272 - 'memcache.local' => '\\OC\\Memcache\\APCu', 273 - 'apps_paths' => 274 - array ( 275 - 0 => 276 - array ( 277 - 'path' => '/var/www/html/apps', 278 - 'url' => '/apps', 279 - 'writable' => true, 280 - ), 281 - 1 => 282 - array ( 283 - 'path' => '/var/www/html/custom_apps', 284 - 'url' => '/custom_apps', 285 - 'writable' => true, 286 - ), 287 - ), 288 - 'memcache.distributed' => '\\OC\\Memcache\\Redis', 289 - 'memcache.locking' => '\\OC\\Memcache\\Redis', 290 - 'redis' => 291 - array ( 292 - 'host' => 'redis', 293 - 'password' => '', 294 - 'port' => 6379, 295 - ), 296 - 'upgrade.disable-web' => true, 297 - 'instanceid' => 'ocxuwrcpcats', 298 - 'passwordsalt' => 'bFuPjx3NMpliQCtY729Uob2SRp19xe', 299 - 'secret' => 'eFMG77LAdbjw6oPSJM7hL/IDPBnP3qDxE7xlX6/uPMOvQ/kG', 300 - 'trusted_domains' => 301 - array ( 302 - 0 => '10.100.200.35:8080', 303 - 1 => 'dfacloud.ddns.net', 304 - 305 - ), 306 - 'datadirectory' => '/var/nextcloud/data', 307 - 'dbtype' => 'mysql', 308 - 'version' => '30.0.6.2', 309 - 'overwrite.cli.url' => 'https://dfacloud.ddns.net', 310 - 'dbname' => 'nextcloud', 311 - 'dbhost' => 'db', 312 - 'dbport' => '', 313 - 'dbtableprefix' => 'oc_', 314 - 'mysql.utf8mb4' => true, 315 - 'dbuser' => 'nextcloud', 316 - 'dbpassword' => 'Ko5b0sq977j1saaCQ3SD55', 317 - 'installed' => true, 318 -); 319 -{{/code}} 320 - 321 -En este fichero php tendremos que tener en cuenta modificar los valores nuestra dirección ip:puerto y nuestra dns en consecuencia. 322 - 323 -=== Permisos === 324 - 325 -Es importante tener en cuenta los permisos de los directorios, sobre todo los directorios de datos y perfiles de usuarios. 326 - 327 -En nuestro caso hemos montado el perfil de usuario en un directorio distinto dado que es una recomendación de seguridad de nextcloud, y además hemos expuesto nuestro disco /datos montando en el host anfitrión al contenedor, por lo que es posible que tengamos que revisar los permisos. 328 - 329 -El usuario y grupo desde el host anfitrión en nuestro caso son: 330 - 331 -* user: 33 (www-data) 332 -* group: tape (www-data) 333 - 334 -Y deben contener permisos 770 335 - 336 -Hemos ajustado el compose para que se adapten estos permisos de forma automática, no obstante es importante revisarles si nextcloud indica algún problema de permisos. 337 - 338 -== Acceso == 339 - 340 -Reiniciamos los contenedores para que apliquen todos los cambios y comprobamos si funciona correctamente accediendo a través del puerto expuesto, en este caso el 8080: 341 - 342 -* [[http:~~/~~/ipservidor:8080>>http://ipservidor:8080]] 343 - 344 -= EXTRA = 345 - 346 -== Compartir recurso que se usa en docker por smb == 347 - 348 -Si vamos a compartir un directorio de datos usado por docker tambien a través de smb, es importante tener en cuenta los permisos. 349 - 350 -Para ello añadiremos nuestro usuario de smb al grupo tape e indicaremos en el recurso smb como usuario valido dicho grupo. 351 - 352 -Para añadir el usuario al grupo tape: 353 - 354 -{{code language="bash"}} 355 -usermod -a -G tape usuario 356 -{{/code}} 357 - 358 -Para configurar el grupo en smb: 359 - 360 -{{code language="bash"}} 361 -[datos] 362 - path = /datos/dFa 363 - browsable = yes 364 - writable = yes 365 - valid users = @tape 366 - #valid users = dFa 367 - read only = no 368 - force create mode = 0777 369 - force directory mode = 0777 370 - guest ok = no 371 -{{/code}} 372 - 373 -De esta manera tanto docker como el usuario de smb que hemos añadido al grupo tape tendrá permisos sobre el recurso. 374 - 375 -También para evitar problemas, es importante asignar ACL's para que el recurso siempre tenga los mismos permisos cuando se añade un nuevo fichero y además aseguramos que el contenido ya existente se encuentra en un estado correcto en cuanto a los mismos: 376 - 377 -{{code language="bash"}} 378 -setfacl -R -m g:tape:rwx /datos/ 379 -setfacl -R -d -m g:tape:rwx /datos/ 380 -{{/code}} 381 - 382 - 383 - 126 +(% class="col-xs-12 col-sm-4" %) 127 +((( 384 384 385 385 ))) 386 386 )))
- 1740216603834-462.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.dFa - Tamaño
-
... ... @@ -1,1 +1,0 @@ 1 -21.8 KB - Contenido
- 1740216641833-376.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.dFa - Tamaño
-
... ... @@ -1,1 +1,0 @@ 1 -4.6 KB - Contenido
- 1740216653242-590.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.dFa - Tamaño
-
... ... @@ -1,1 +1,0 @@ 1 -19.9 KB - Contenido