nextcloud安全问题修复
1、 PHP 的设置似乎有问题, 无法获取系统环境变量. 使用 getenv("PATH") 测试时仅返回空结果
getenv问题:在php-fpm.conf 中加上
env[PATH] = /usr/local/bin:/usr/bin:/bin:/usr/local/php/bin
重启一下php-fpm就可以了
2、 LNMP 1.5上如果不想用防跨目录或者修改.user.ini的防跨目录的目录;【还需要将 /usr/local/nginx/conf/fastcgi.conf 里面的fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; 在该行行前添加 # 或删除改行,】需要重启nginx。
3、 显示opchache状态和数据的web页面。github链接
4、开启opcache
4.1安装
进入lnmp解压后的目录,执行:
./addons.sh install opcache
Opcache和eAccelerator是冲突的,脚本会卸载eAccelerator后再安装Opcache,回车确认后就会自动安装opcache。
4.2修改php.ini文件
4.3重启php
卸载
执行:./addons.sh uninstall opcache
5、添加ssl证书:
lnmp ssl add
6、配置证书301和hsts(来源 liberalmanl)
6.1 在433代码段内添加
add_header Strict-Transport-Security "max-age=155520; includeSubdomains; preload"; add_header X-Frame-Options "SAMEORIGIN"; #设置后,依然报错,我就把这行删了
6.2相关知识:修改web服务器配置,添加X-frame-options响应头。赋值有如下三种:
(1)DENY:不能被嵌入到任何iframe或frame中。
(2)SAMEORIGIN:页面只能被本站页面嵌入到iframe或者frame中。(nextcloud推荐是这个)
(3)ALLOW-FROM uri:只能被嵌入到指定域名的框架中。
6.3在80代码段内添加
return 301 https://$host;