测试文章
nextcloud可以通过加载自定义的css,从而修改nextcloud的显示样式。
样式参考
本次修改,增加了很多毛玻璃和半透明效果,还将壁纸从默认壁纸改成了必应的每日壁纸。


修改css
- 在nextcloud网页根目录的themes中创建一个文件夹:“mytheme”(可以自定义,这个就是后面的主题名称);
- 在“mytheme”中创建文件夹:“core”;
- “core”中创建“css”文件夹;
4.下载“server.css”文件:
[login]点击下载:“server.css”[/login]
5.将“server.css”添加到“css”文件夹下;
6.修改nextcloud的config.php文件(在config文件夹下);
添加或修改:
'theme' => 'mytheme',7.刷新页面即可发现修改成功。
添加图片代理
如果不使用每日壁纸可以不做下面的修改。
因为nextcloud有自己的CSP,限制跨域的文件访问。
因此需要在本域名下做代理。
在配置文件中添加:
location = /bing {
# 关键:直接代理到 https://www.tianlingzi.top/bing/1920x1080.php
proxy_pass https://bing-backend/bing/1920x1080.php ;
# Nginx 拦截上游 301/302/307,自动跟随跳转
proxy_intercept_errors on;
error_page 301 302 307 = @handle_redirect;
# HTTPS 代理推荐配置
proxy_ssl_server_name on;
proxy_set_header Host www.tianlingzi.top;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
location @handle_redirect {
# 重新构造目标 URL:使用 upstream 域名 + 上游 Location 头里的路径
# $upstream_http_location 形如:https://www.tianlingzi.top/bing/cache/xxx.jpg
# 我们用正则把路径部分提取出来,再拼到 bing-backend 上
set $bing_path '';
if ($upstream_http_location ~ ^https://www\.tianlingzi\.top(/bing/cache/.*)) {
set $bing_path $1;
}
# 如果正则没匹配上,给个默认值(防止空路径)
if ($bing_path = '') {
set $bing_path '/bing/cache/default.jpg'; # 按你实际调整
}
proxy_pass https://bing-backend$bing_path ;
proxy_ssl_server_name on;
proxy_set_header Host www.tianlingzi.top;
}这里的主题和配置文件直接使用的是本站提供的bing每日壁纸代理服务。可按需修改,只需修改nginx代理配置就行,因为主题文件里是访问:域名/bing,再由nginx转接到目标地点。
至此,修改完成。