Daily Shaarli

All links of one day in a single page.

November 14, 2019

Oneinstack中 搭建 NextCloud 报错解决及性能优化

后台错误及警告解决

PHP 内存限制低于建议值 512MB。
解决:
编辑文件 /usr/local/php/etc/php.ini
memory_limit = 1024M
内存缓存未配置,为了提升使用体验,请尽量配置内存缓存。更多信息请参见文档。
解决:
1.安装 Redis 以及 PHP 的 Redis 模块
2.将相关配置代码添加至 NextCloud 目录 /config/config.php
HTTP 请求头 "X-Frame-Options" 没有配置为 "SAMEORIGIN
HTTP的请求头 “Referrer-Policy” 未设置为 “no-referrer”, “no-referrer-when-downgrade”, “strict-origin” or “strict-origin-when-cross-origin”. 这会导致信息泄露
解决:
编辑文件 /usr/local/nginx/conf/vhost/pan.tap.tw.conf
添加以下字段至 server
add_header X-Frame-Options SAMEORIGIN;
add_header Referrer-Policy "no-referrer";

下载大文件(>1G)自动中断的问题

原因:由 PHP 和 Nginx 共同限制超时时间造成的
解决:
1./usr/local/php/etc/php.ini
执行时间(上传和下载):

max_execution_time = 3600

上传相关:

max_input_time = 3600
post_max_size = 10240M
upload_max_filesize = 10240M
max_file_uploads = 200

2./usr/local/php/etc/php-fpm.conf

request_terminate_timeout = 3600

3./usr/local/nginx/conf/nginx.conf(可选,遇到问题再改)

fastcgi_connect_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_read_timeout 3600;

也可修改vhost下单个网站的独立配置