我的确遇到很多坑,第一个坑,就是重启之后,系统不能用了。

原因很简单,我的selinux 没有关闭。

坑2、

升级了之后,不知道如何退出维护模式。

这里附上nextcloud的维护模式关闭和开启。

PS:以下命令,需要进入nextcloud的安装目录内,找到occ命令后,执行,如果是centos环境那么要改成 apache php xxxxx即可

sudo -u nginx php occ maintenance:mode --on
sudo -u nginx php occ maintenance:mode --off

然后的坑就是给nextcloud配置缓存。

这里我好像还有报错,听说用ubuntu问题比较少。

我总结一下其它的。

参考这篇博文https://blog.csdn.net/weixin_41004350/article/details/80479051

里面有一个

opcache 

我找了好久,原来是Centos7里面的位置变了,在/etc/php.d/opcache.ini 去改参数。

 

终于找到隐藏已久的坑,这里要参考nextcloud的官方文档,虽然是全英文,但是看看还是很有价值的。

https://docs.nextcloud.com/server/13/admin_manual/installation/system_requirements.html

这里有很多说明,可以慢慢。

直接说坑吧,就是关于nextcloud里提示X-Frame-Options" 没有配置为 "SAMEORIGIN"

一直报错,

我各种排查,首先检查/usr/share/nginx/html/nextcloud/config/config.php里的配置,里面有SAMEORIGIN这项,一步一步参考官方资料。

官方代码

  1 upstream php-handler {
  2     server 127.0.0.1:9000;
  3     #server unix:/var/run/php5-fpm.sock;
  4 }
  5 
  6 server {
  7     listen 80;
  8     listen [::]:80;
  9     server_name cloud.example.com;
 10     # enforce https
 11     return 301 https://$server_name$request_uri;
 12 }
 13 
 14 server {
 15     listen 443 ssl http2;
 16     listen [::]:443 ssl http2;
 17     server_name cloud.example.com;
 18 
 19     ssl_certificate /etc/ssl/nginx/cloud.example.com.crt;
 20     ssl_certificate_key /etc/ssl/nginx/cloud.example.com.key;
 21 
 22     # Add headers to serve security related headers
 23     # Before enabling Strict-Transport-Security headers please read into this
 24     # topic first.
 25     #add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
 26     add_header X-Content-Type-Options nosniff;
 27     add_header X-XSS-Protection "1; mode=block";
 28     add_header X-Robots-Tag none;
 29     add_header X-Download-Options noopen;
 30     add_header X-Permitted-Cross-Domain-Policies none;
 31 
 32     # Path to the root of your installation
 33     root /var/www/;
 34 
 35     location = /robots.txt {
 36         allow all;
 37         log_not_found off;
 38         access_log off;
 39     }
 40 
 41     # The following 2 rules are only needed for the user_webfinger app.
 42     # Uncomment it if you're planning to use this app.
 43     # rewrite ^/.well-known/host-meta /nextcloud/public.php?service=host-meta
 44     # last;
 45     #rewrite ^/.well-known/host-meta.json
 46     # /nextcloud/public.php?service=host-meta-json last;
 47 
 48     location = /.well-known/carddav {
 49       return 301 $scheme://$host/nextcloud/remote.php/dav;
 50     }
 51     location = /.well-known/caldav {
 52       return 301 $scheme://$host/nextcloud/remote.php/dav;
 53     }
 54 
 55     location /.well-known/acme-challenge { }
 56 
 57     location ^~ /nextcloud {
 58 
 59         # set max upload size
 60         client_max_body_size 512M;
 61         fastcgi_buffers 64 4K;
 62 
 63         # Enable gzip but do not remove ETag headers
 64         gzip on;
 65         gzip_vary on;
 66         gzip_comp_level 4;
 67         gzip_min_length 256;
 68         gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
 69         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;
 70 
 71         # Uncomment if your server is build with the ngx_pagespeed module
 72         # This module is currently not supported.
 73         #pagespeed off;
 74 
 75         location /nextcloud {
 76             rewrite ^ /nextcloud/index.php$request_uri;
 77         }
 78 
 79         location ~ ^/nextcloud/(?:build|tests|config|lib|3rdparty|templates|data)/ {
 80             deny all;
 81         }
 82         location ~ ^/nextcloud/(?:\.|autotest|occ|issue|indie|db_|console) {
 83             deny all;
 84         }
 85 
 86         location ~ ^/nextcloud/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
 87             fastcgi_split_path_info ^(.+?\.php)(/.*)$;
 88             include fastcgi_params;
 89             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 90             fastcgi_param PATH_INFO $fastcgi_path_info;
 91             fastcgi_param HTTPS on;
 92             #Avoid sending the security headers twice
 93             fastcgi_param modHeadersAvailable true;
 94             fastcgi_param front_controller_active true;
 95             fastcgi_pass php-handler;
 96             fastcgi_intercept_errors on;
 97             fastcgi_request_buffering off;
 98         }
 99 
100         location ~ ^/nextcloud/(?:updater|ocs-provider)(?:$|/) {
101             try_files $uri/ =404;
102             index index.php;
103         }
104 
105         # Adding the cache control header for js and css files
106         # Make sure it is BELOW the PHP block
107         location ~ \.(?:css|js|woff|svg|gif)$ {
108             try_files $uri /nextcloud/index.php$request_uri;
109             add_header Cache-Control "public, max-age=15778463";
110             # Add headers to serve security related headers  (It is intended
111             # to have those duplicated to the ones above)
112             # Before enabling Strict-Transport-Security headers please read
113             # into this topic first.
114             # add_header Strict-Transport-Security "max-age=15768000;
115             # includeSubDomains; preload;";
116             add_header X-Content-Type-Options nosniff;
117             add_header X-XSS-Protection "1; mode=block";
118             add_header X-Robots-Tag none;
119             add_header X-Download-Options noopen;
120             add_header X-Permitted-Cross-Domain-Policies none;
121             # Optional: Don't log access to assets
122             access_log off;
123         }
124 
125         location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
126             try_files $uri /nextcloud/index.php$request_uri;
127             # Optional: Don't log access to other assets
128             access_log off;
129         }
130     }
131 }
View Code

相关文章: