diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2025-01-28 14:27:57 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2025-01-28 14:27:57 +0100 |
commit | 5b4c769b7f491c181eea26dcbf9df46046621bd9 (patch) | |
tree | d7bc9d9120ed69034a24ad0ec18ef7e55a984eb3 /roles | |
parent | dc9acda297a0eebec6d38bcf7243305161ce6527 (diff) |
Adjust nextcloud nginx and PHP-FPM config for bookworm.
Diffstat (limited to 'roles')
-rw-r--r-- | roles/nextcloud/files/etc/nginx/sites-available/nextcloud | 37 | ||||
-rw-r--r-- | roles/nextcloud/files/etc/php/fpm/pool.d/nextcloud.conf | 2 | ||||
-rw-r--r-- | roles/nextcloud/handlers/main.yml | 4 | ||||
-rw-r--r-- | roles/nextcloud/tasks/main.yml | 28 |
4 files changed, 43 insertions, 28 deletions
diff --git a/roles/nextcloud/files/etc/nginx/sites-available/nextcloud b/roles/nextcloud/files/etc/nginx/sites-available/nextcloud index 2abce2d..f1f4dcc 100644 --- a/roles/nextcloud/files/etc/nginx/sites-available/nextcloud +++ b/roles/nextcloud/files/etc/nginx/sites-available/nextcloud @@ -32,6 +32,12 @@ server { ssl_certificate_key ssl/cloud.fripost.org.key; include snippets/cloud.fripost.org.hpkp-hdr; + include mime.types; + types { + text/javascript js mjs; + application/wasm wasm; + } + location = /robots.txt { allow all; log_not_found off; @@ -41,6 +47,8 @@ server { access_log /var/log/nginx/cloud.access.log; error_log /var/log/nginx/cloud.error.log info; + index index.php index.html /index.php$request_uri; + location = /.well-known/carddav { return 301 /remote.php/dav; } location = /.well-known/caldav { return 301 /remote.php/dav; } location ^~ /.well-known/ { return 301 /index.php$request_uri; } @@ -59,34 +67,41 @@ server { 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; location = / { return 303 /apps/files/; } - location / { rewrite ^ /index.php$uri last; } location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ { internal; } location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { internal; } - location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+|core/templates/40[34])\.php(?:$|/) { + location ~ \.php(?:$|/) { + # Required for legacy support + rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode(_arm64)?\/proxy) /index.php$request_uri; + include snippets/fastcgi-php.conf; fastcgi_param modHeadersAvailable true; fastcgi_param front_controller_active true; fastcgi_intercept_errors on; fastcgi_request_buffering off; - fastcgi_pass unix:/run/php/php7.4-fpm@nextcloud.sock; + fastcgi_pass unix:/run/php/php8.2-fpm@nextcloud.sock; } - location ~ ^/(?:updater|oc[ms]-provider)(?:$|/) { - try_files $uri/ =404; - index index.php; - } - - location ~ \.(?:css|js|woff2?|svg|gif|map)$ { - expires 30d; + location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ { try_files $uri /index.php$uri$is_args$args; } - + location ~ \.woff2?$ { + try_files $uri /index.php$request_uri; + expires 7d; + } location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { try_files $uri /index.php$uri$is_args$args; } + location /remote { + return 301 /remote.php$request_uri; + } + + location / { + try_files $uri $uri/ /index.php$request_uri; + } + location = /core/img/favicon.ico { alias /var/www/nextcloud/fripost.ico; } diff --git a/roles/nextcloud/files/etc/php/fpm/pool.d/nextcloud.conf b/roles/nextcloud/files/etc/php/fpm/pool.d/nextcloud.conf index 001ebf8..898ce60 100644 --- a/roles/nextcloud/files/etc/php/fpm/pool.d/nextcloud.conf +++ b/roles/nextcloud/files/etc/php/fpm/pool.d/nextcloud.conf @@ -1,7 +1,7 @@ [nextcloud] user = _nextcloud group = nogroup -listen = /run/php/php7.4-fpm@nextcloud.sock +listen = /run/php/php8.2-fpm@nextcloud.sock listen.owner = www-data listen.group = www-data listen.mode = 0600 diff --git a/roles/nextcloud/handlers/main.yml b/roles/nextcloud/handlers/main.yml index 2fdd8b7..a14d6e1 100644 --- a/roles/nextcloud/handlers/main.yml +++ b/roles/nextcloud/handlers/main.yml @@ -1,6 +1,6 @@ --- -- name: Restart php7.4-fpm - service: name=php7.4-fpm state=restarted +- name: Restart php8.2-fpm + service: name=php8.2-fpm state=restarted - name: Restart Redis service: name=redis-server state=restarted diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index 69a662d..14bc02c 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -19,8 +19,8 @@ - php-json - php-gmp -- name: Configure PHP 7.4 Zend opcache - lineinfile: dest=/etc/php/7.4/fpm/php.ini +- name: Configure PHP 8.2 Zend opcache + lineinfile: dest=/etc/php/8.2/fpm/php.ini regexp='^;?{{ item.var }}\\s*=' line="{{ item.var }} = {{ item.value }}" owner=root group=root @@ -30,10 +30,10 @@ - { var: opcache.revalidate_freq, value: 180 } - { var: opcache.interned_strings_buffer, value: 12 } notify: - - Restart php7.4-fpm + - Restart php8.2-fpm -- name: Configure PHP 7.4 CLI - lineinfile: dest=/etc/php/7.4/cli/php.ini +- name: Configure PHP 8.2 CLI + lineinfile: dest=/etc/php/8.2/cli/php.ini regexp='^;?{{ item.var }}\\s*=' line="{{ item.var }} = {{ item.value }}" owner=root group=root @@ -50,21 +50,21 @@ password=! state=present -- name: Delete PHP 7.4 FPM's www pool - file: path=/etc/php/7.4/fpm/pool.d/www.conf state=absent +- name: Delete PHP 8.2 FPM's www pool + file: path=/etc/php/8.2/fpm/pool.d/www.conf state=absent notify: - - Restart php7.4-fpm + - Restart php8.2-fpm -- name: Configure PHP 7.4 FPM's nextcloud pool +- name: Configure PHP 8.2 FPM's nextcloud pool copy: src=etc/php/fpm/pool.d/nextcloud.conf - dest=/etc/php/7.4/fpm/pool.d/nextcloud.conf + dest=/etc/php/8.2/fpm/pool.d/nextcloud.conf owner=root group=root mode=0644 notify: - - Restart php7.4-fpm + - Restart php8.2-fpm -- name: Start php7.4-fpm - service: name=php7.4-fpm state=started +- name: Start php8.2-fpm + service: name=php8.2-fpm state=started - name: Copy /etc/cron.d/nextcloud copy: src=etc/cron.d/nextcloud @@ -191,7 +191,7 @@ - name: Add '_nextcloud' user to 'redis' group user: name=_nextcloud groups=redis append=yes notify: - - Restart php7.4-fpm + - Restart php8.2-fpm - name: Install other Nextcloud dependencies apt: pkg={{ packages }} |