{"id":766,"date":"2021-06-25T18:31:04","date_gmt":"2021-06-25T18:31:04","guid":{"rendered":"https:\/\/asgardius.company\/?p=766"},"modified":"2021-06-25T18:31:04","modified_gmt":"2021-06-25T18:31:04","slug":"instalando-nextcloud-en-ubuntu-20-04-con-nginx","status":"publish","type":"post","link":"https:\/\/asgardius.company\/?p=766","title":{"rendered":"Instalando Nextcloud en Ubuntu 20.04 con NGINX"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/asgardius.company\/wp-content\/uploads\/2021\/06\/sky-1441936_960_720.jpg\" alt=\"\" class=\"wp-image-560\"\/><\/figure>\n\n\n\n<p>Para instalar Nextcloud con esta configuraci\u00f3n necesitamos un servidor LEMP al cual le agregamos los siguientes m\u00f3dulos<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install php-ldap php-imagick libmagickcore-6.q16-6-extra php-bcmath php-gmp php-apcu<\/code><\/pre>\n\n\n\n<p>Editamos el archivo de configuraci\u00f3n correspondiente a nuestro host de nextcloud en NGINX<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/nginx\/sites-enabled\/cloud.asgardius.company<\/code><\/pre>\n\n\n\n<p>Lo dejamos parecido a este<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>upstream php-handler {\n    #server 127.0.0.1:9000;\n    server unix:\/var\/run\/php\/php7.4-fpm.sock;\n    #server unix:\/var\/run\/php\/php7.3-fpm.sock;\n}\n\nserver {\n    listen 80;\n    listen &#91;::]:80;\n    server_name cloud.asgardius.company;\n\n    # Enforce HTTPS\n    return 301 https:\/\/$server_name$request_uri;\n}\n\nserver {\n    listen 443      ssl http2;\n    listen &#91;::]:443 ssl http2;\n    server_name cloud.asgardius.company;\n\n    # Use Mozilla's guidelines for SSL\/TLS settings\n    # https:\/\/mozilla.github.io\/server-side-tls\/ssl-config-generator\/\n    ssl_certificate     \/etc\/letsencrypt\/live\/cloud.asgardius.company\/fullchain.pem;\n    ssl_certificate_key \/etc\/letsencrypt\/live\/cloud.asgardius.company\/privkey.pem;\n\n    # HSTS settings\n    # WARNING: Only add the preload option once you read about\n    # the consequences in https:\/\/hstspreload.org\/. This option\n    # will add the domain to a hardcoded list that is shipped\n    # in all major browsers and getting removed from this list\n    # could take several months.\n    #add_header Strict-Transport-Security \"max-age=15768000; includeSubDomains; preload;\" always;\n\n    # set max upload size\n    client_max_body_size 512M;\n    fastcgi_buffers 64 4K;\n\n    # Enable gzip but do not remove ETag headers\n    gzip on;\n    gzip_vary on;\n    gzip_comp_level 4;\n    gzip_min_length 256;\n    gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;\n    gzip_types application\/atom+xml application\/javascript application\/json application\/ld+json application\/manifest+json application\/rss+xml application\/vnd.geo+json application\/vnd.ms-fontobject 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;\n\n    # Pagespeed is not supported by Nextcloud, so if your server is built\n    # with the `ngx_pagespeed` module, uncomment this line to disable it.\n    #pagespeed off;\n\n    # HTTP response headers borrowed from Nextcloud `.htaccess`\n    add_header Referrer-Policy                      \"no-referrer\"   always;\n    add_header X-Content-Type-Options               \"nosniff\"       always;\n    add_header X-Download-Options                   \"noopen\"        always;\n    add_header X-Frame-Options                      \"SAMEORIGIN\"    always;\n    add_header X-Permitted-Cross-Domain-Policies    \"none\"          always;\n    add_header X-Robots-Tag                         \"none\"          always;\n    add_header X-XSS-Protection                     \"1; mode=block\" always;\n\n    # Remove X-Powered-By, which is an information leak\n    fastcgi_hide_header X-Powered-By;\n\n    # Path to the root of your installation\n    root \/var\/www\/nextcloud;\n\n    # Specify how to handle directories -- specifying `\/index.php$request_uri`\n    # here as the fallback means that Nginx always exhibits the desired behaviour\n    # when a client requests a path that corresponds to a directory that exists\n    # on the server. In particular, if that directory contains an index.php file,\n    # that file is correctly served; if it doesn't, then the request is passed to\n    # the front-end controller. This consistent behaviour means that we don't need\n    # to specify custom rules for certain paths (e.g. images and other assets,\n    # `\/updater`, `\/ocm-provider`, `\/ocs-provider`), and thus\n    # `try_files $uri $uri\/ \/index.php$request_uri`\n    # always provides the desired behaviour.\n    index index.php index.html \/index.php$request_uri;\n\n    # Rule borrowed from `.htaccess` to handle Microsoft DAV clients\n    location = \/ {\n        if ( $http_user_agent ~ ^DavClnt ) {\n            return 302 \/remote.php\/webdav\/$is_args$args;\n        }\n    }\n\n    location = \/robots.txt {\n        allow all;\n        log_not_found off;\n        access_log off;\n    }\n\n    # Make a regex exception for `\/.well-known` so that clients can still\n    # access it despite the existence of the regex rule\n    # `location ~ \/(\\.|autotest|...)` which would otherwise handle requests\n    # for `\/.well-known`.\n    location ^~ \/.well-known {\n        # The rules in this block are an adaptation of the rules\n        # in `.htaccess` that concern `\/.well-known`.\n\n        location = \/.well-known\/carddav { return 301 \/remote.php\/dav\/; }\n        location = \/.well-known\/caldav  { return 301 \/remote.php\/dav\/; }\n\n        location \/.well-known\/acme-challenge    { try_files $uri $uri\/ =404; }\n        location \/.well-known\/pki-validation    { try_files $uri $uri\/ =404; }\n\n        # Let Nextcloud's API for `\/.well-known` URIs handle all other\n        # requests by passing them to the front-end controller.\n        return 301 \/index.php$request_uri;\n    }\n\n    # Rules borrowed from `.htaccess` to hide certain paths from clients\n    location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|\/)  { return 404; }\n    location ~ ^\/(?:\\.|autotest|occ|issue|indie|db_|console)                { return 404; }\n\n    # Ensure this block, which passes PHP files to the PHP process, is above the blocks\n    # which handle static assets (as seen below). If this block is not declared first,\n    # then Nginx will encounter an infinite rewriting loop when it prepends `\/index.php`\n    # to the URI, resulting in a HTTP 500 error response.\n    location ~ \\.php(?:$|\/) {\n        fastcgi_split_path_info ^(.+?\\.php)(\/.*)$;\n        set $path_info $fastcgi_path_info;\n\n        try_files $fastcgi_script_name =404;\n\n        include fastcgi_params;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        fastcgi_param PATH_INFO $path_info;\n        fastcgi_param HTTPS on;\n\n        fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twice\n        fastcgi_param front_controller_active true;     # Enable pretty urls\n        fastcgi_pass php-handler;\n\n        fastcgi_intercept_errors on;\n        fastcgi_request_buffering off;\n    }\n\n    location ~ \\.(?:css|js|svg|gif)$ {\n        try_files $uri \/index.php$request_uri;\n        expires 6M;         # Cache-Control policy borrowed from `.htaccess`\n        access_log off;     # Optional: Don't log access to assets\n    }\n\n    location ~ \\.woff2?$ {\n        try_files $uri \/index.php$request_uri;\n        expires 7d;         # Cache-Control policy borrowed from `.htaccess`\n        access_log off;     # Optional: Don't log access to assets\n    }\n\n    # Rule borrowed from `.htaccess`\n    location \/remote {\n        return 301 \/remote.php$request_uri;\n    }\n\n    location \/ {\n        try_files $uri $uri\/ \/index.php$request_uri;\n    }\n}<\/code><\/pre>\n\n\n\n<p>Creamos una base de datos MySQL y un usuario con permisos de acceso a esta<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mysql -u root\nCREATE DATABASE nextcloud;\nCREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'password';\nGRANT ALL ON nextcloud.* TO 'nextcloud'@'localhost';<\/code><\/pre>\n\n\n\n<p>Descargamos el instalador web de Nextcloud y lo movemos al directorio ra\u00edz de nuestro servidor web<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/download.nextcloud.com\/server\/installer\/setup-nextcloud.php\nsudo mv setup-nextcloud.php \/var\/www\/nextcloud\nsudo chown -R www-data:www-data \/var\/www\/nextcloud<\/code><\/pre>\n\n\n\n<p>Introducimos la direcci\u00f3n de nuestro servidor web en el navegador apuntando al archivo setup-nextcloud.php y seguimos las instrucciones hasta finalizar la instalaci\u00f3n. Una vez instalado nos quedar\u00eda algo similar a esto<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/asgardius.company\/wp-content\/uploads\/2021\/06\/Captura-de-pantalla-de-2021-03-10-13-07-13-1024x550.png\" alt=\"\" class=\"wp-image-462\"\/><\/figure>\n\n\n\n<p>Referencias<\/p>\n\n\n\n<p><a href=\"https:\/\/docs.nextcloud.com\/server\/latest\/admin_manual\/installation\/nginx.html\">https:\/\/docs.nextcloud.com\/server\/latest\/admin_manual\/installation\/nginx.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Para instalar Nextcloud con esta configuraci\u00f3n necesitamos un servidor LEMP al cual le agregamos los siguientes m\u00f3dulos Editamos el archivo de configuraci\u00f3n correspondiente a nuestro host de nextcloud en NGINX Lo dejamos parecido a este Creamos una base de datos MySQL y un usuario con permisos de acceso a esta Descargamos el instalador web de&hellip; <a class=\"more-link\" href=\"https:\/\/asgardius.company\/?p=766\">Seguir leyendo <span class=\"screen-reader-text\">Instalando Nextcloud en Ubuntu 20.04 con NGINX<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-766","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"_links":{"self":[{"href":"https:\/\/asgardius.company\/index.php?rest_route=\/wp\/v2\/posts\/766","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/asgardius.company\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/asgardius.company\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/asgardius.company\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/asgardius.company\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=766"}],"version-history":[{"count":0,"href":"https:\/\/asgardius.company\/index.php?rest_route=\/wp\/v2\/posts\/766\/revisions"}],"wp:attachment":[{"href":"https:\/\/asgardius.company\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=766"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/asgardius.company\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=766"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/asgardius.company\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=766"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}