差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
软件:nextcloud [2025/10/12 17:46] – admin | 软件:nextcloud [2025/10/12 18:38] (当前版本) – admin | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | **.conf** | ||
+ | |||
nextcloud | nextcloud | ||
网盘 | 网盘 | ||
+ | |||
+ | 网络快捷安装 | ||
+ | |||
+ | <code -> | ||
+ | sudo apt install snap | ||
+ | sudo snap install nextcloud | ||
+ | # | ||
+ | snap changes nextcloud | ||
+ | </ | ||
+ | |||
+ | 传统安装部署 | ||
php安装 | php安装 | ||
行 33: | 行 46: | ||
</ | </ | ||
- | 配置WEB | + | Nginx配置 |
NGINX configuration — Nextcloud latest Administration Manual latest documentation | NGINX configuration — Nextcloud latest Administration Manual latest documentation | ||
- | https:// | + | [[https:// |
+ | |||
+ | <code nginx nginx.conf> | ||
+ | # Version 2025-07-23 | ||
+ | |||
+ | upstream php-handler { | ||
+ | server 127.0.0.1: | ||
+ | #server unix:/ | ||
+ | } | ||
+ | |||
+ | # Set the `immutable` cache control options only for assets with a cache busting `v` argument | ||
+ | map $arg_v $asset_immutable { | ||
+ | "" | ||
+ | default ", immutable"; | ||
+ | } | ||
+ | |||
+ | server { | ||
+ | listen 80; | ||
+ | listen [::]:80; | ||
+ | server_name cloud.example.com; | ||
+ | |||
+ | # Prevent nginx HTTP Server Detection | ||
+ | server_tokens off; | ||
+ | |||
+ | # Enforce HTTPS | ||
+ | return 301 https:// | ||
+ | } | ||
+ | |||
+ | server { | ||
+ | listen 443 ssl http2; | ||
+ | listen [::]:443 ssl http2; | ||
+ | # With NGinx >= 1.25.1 you should use this instead: | ||
+ | # listen 443 ssl; | ||
+ | # listen [::]:443 ssl; | ||
+ | # http2 on; | ||
+ | server_name cloud.example.com; | ||
+ | |||
+ | # Path to the root of your installation | ||
+ | root / | ||
+ | |||
+ | # Use Mozilla' | ||
+ | # https:// | ||
+ | ssl_certificate | ||
+ | ssl_certificate_key / | ||
+ | |||
+ | # Prevent nginx HTTP Server Detection | ||
+ | server_tokens off; | ||
+ | |||
+ | # HSTS settings | ||
+ | # WARNING: Only add the preload option once you read about | ||
+ | # the consequences in https:// | ||
+ | # will add the domain to a hardcoded list that is shipped | ||
+ | # in all major browsers and getting removed from this list | ||
+ | # could take several months. | ||
+ | #add_header Strict-Transport-Security " | ||
+ | |||
+ | # set max upload size and increase upload timeout: | ||
+ | client_max_body_size 512M; | ||
+ | client_body_timeout 300s; | ||
+ | fastcgi_buffers 64 4K; | ||
+ | |||
+ | # Proxy and client response timeouts | ||
+ | # Uncomment an increase these if facing timeout errors during large file uploads | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Enable gzip but do not remove ETag headers | ||
+ | gzip on; | ||
+ | gzip_vary on; | ||
+ | gzip_comp_level 4; | ||
+ | gzip_min_length 256; | ||
+ | gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; | ||
+ | gzip_types application/ | ||
+ | |||
+ | # Pagespeed is not supported by Nextcloud, so if your server is built | ||
+ | # with the `ngx_pagespeed` module, uncomment this line to disable it. | ||
+ | #pagespeed off; | ||
+ | |||
+ | # The settings allows you to optimize the HTTP2 bandwidth. | ||
+ | # See https:// | ||
+ | # for tuning hints | ||
+ | client_body_buffer_size 512k; | ||
+ | |||
+ | # HTTP response headers borrowed from Nextcloud `.htaccess` | ||
+ | add_header Referrer-Policy | ||
+ | add_header X-Content-Type-Options | ||
+ | add_header X-Frame-Options | ||
+ | add_header X-Permitted-Cross-Domain-Policies " | ||
+ | add_header X-Robots-Tag | ||
+ | |||
+ | # Remove X-Powered-By, | ||
+ | fastcgi_hide_header X-Powered-By; | ||
+ | |||
+ | # Set .mjs and .wasm MIME types | ||
+ | # Either include it in the default mime.types list | ||
+ | # and include that list explicitly or add the file extension | ||
+ | # only for Nextcloud like below: | ||
+ | include mime.types; | ||
+ | types { | ||
+ | text/ | ||
+ | application/ | ||
+ | } | ||
+ | |||
+ | # Specify how to handle directories -- specifying `/ | ||
+ | # here as the fallback means that Nginx always exhibits the desired behaviour | ||
+ | # when a client requests a path that corresponds to a directory that exists | ||
+ | # on the server. In particular, if that directory contains an index.php file, | ||
+ | # that file is correctly served; if it doesn' | ||
+ | # the front-end controller. This consistent behaviour means that we don't need | ||
+ | # to specify custom rules for certain paths (e.g. images and other assets, | ||
+ | # `/updater`, `/ | ||
+ | # `try_files $uri $uri/ / | ||
+ | # always provides the desired behaviour. | ||
+ | index index.php index.html / | ||
+ | |||
+ | # Rule borrowed from `.htaccess` to handle Microsoft DAV clients | ||
+ | location = / { | ||
+ | if ( $http_user_agent ~ ^DavClnt ) { | ||
+ | return 302 / | ||
+ | } | ||
+ | } | ||
+ | |||
+ | location = /robots.txt { | ||
+ | allow all; | ||
+ | log_not_found off; | ||
+ | access_log off; | ||
+ | } | ||
+ | |||
+ | # Make a regex exception for `/ | ||
+ | # access it despite the existence of the regex rule | ||
+ | # `location ~ / | ||
+ | # for `/ | ||
+ | location ^~ / | ||
+ | # The rules in this block are an adaptation of the rules | ||
+ | # in `.htaccess` that concern `/ | ||
+ | |||
+ | location = / | ||
+ | location = / | ||
+ | |||
+ | location / | ||
+ | location / | ||
+ | |||
+ | # Let Nextcloud' | ||
+ | # requests by passing them to the front-end controller. | ||
+ | return 301 / | ||
+ | } | ||
+ | |||
+ | # Rules borrowed from `.htaccess` to hide certain paths from clients | ||
+ | location ~ ^/ | ||
+ | location ~ ^/ | ||
+ | |||
+ | # Ensure this block, which passes PHP files to the PHP process, is above the blocks | ||
+ | # which handle static assets (as seen below). If this block is not declared first, | ||
+ | # then Nginx will encounter an infinite rewriting loop when it prepends `/ | ||
+ | # to the URI, resulting in a HTTP 500 error response. | ||
+ | location ~ \.php(?: | ||
+ | # Required for legacy support | ||
+ | rewrite ^/ | ||
+ | |||
+ | fastcgi_split_path_info ^(.+? | ||
+ | set $path_info $fastcgi_path_info; | ||
+ | |||
+ | try_files $fastcgi_script_name =404; | ||
+ | |||
+ | include fastcgi_params; | ||
+ | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
+ | fastcgi_param PATH_INFO $path_info; | ||
+ | fastcgi_param HTTPS on; | ||
+ | |||
+ | fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice | ||
+ | fastcgi_param front_controller_active true; # Enable pretty urls | ||
+ | fastcgi_pass php-handler; | ||
+ | |||
+ | fastcgi_intercept_errors on; | ||
+ | fastcgi_request_buffering on; # Required as PHP-FPM does not support chunked transfer encoding and requires a valid ContentLength header. | ||
+ | |||
+ | # PHP-FPM 504 response timeouts | ||
+ | # Uncomment and increase these if facing timeout errors during large file uploads | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | |||
+ | fastcgi_max_temp_file_size 0; | ||
+ | } | ||
+ | |||
+ | # Serve static files | ||
+ | location ~ \.(?: | ||
+ | try_files $uri / | ||
+ | # HTTP response headers borrowed from Nextcloud `.htaccess` | ||
+ | add_header Cache-Control | ||
+ | add_header Referrer-Policy | ||
+ | add_header X-Content-Type-Options | ||
+ | add_header X-Frame-Options | ||
+ | add_header X-Permitted-Cross-Domain-Policies " | ||
+ | add_header X-Robots-Tag | ||
+ | access_log off; # Optional: Don't log access to assets | ||
+ | } | ||
+ | |||
+ | location ~ \.(otf|woff2? | ||
+ | try_files $uri / | ||
+ | expires 7d; # Cache-Control policy borrowed from `.htaccess` | ||
+ | access_log off; # Optional: Don't log access to assets | ||
+ | } | ||
+ | |||
+ | # Rule borrowed from `.htaccess` | ||
+ | location /remote { | ||
+ | return 301 / | ||
+ | } | ||
+ | |||
+ | location / { | ||
+ | try_files $uri $uri/ / | ||
+ | } | ||
+ | } | ||
+ | </ | ||
SQL配置 | SQL配置 |