# yunhe **Repository Path**: lopinx/yunhe ## Basic Information - **Project Name**: yunhe - **Description**: No description available - **Primary Language**: Unknown - **License**: WTFPL - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-05-08 - **Last Updated**: 2025-05-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### 云核泛目录 #### 伪静态 ``` nginx # 屏蔽黑名单中的 User-Agent if ($http_user_agent ~* "DotBot|MauiBot|MegaIndex|BLEXBot|Qwantify|SEMrush|Serpstatbot|hubspot|PhantomJS|Scrapy|Webdup|AcoonBot|AhrefsBot|Ezooms|EdisterBot|EC2LinkFinder|jikespider|Purebot|MJ12bot|WangIDSpider|WBSearchBot|Wotbox|xbfMozilla|Yottaa|Jorgee|SWEBot|spbot|TurnitinBot-Agent|mail\.RU|perl|Wget|Xenu|ZmEu") { return 403; } # 禁用空 User-Agent if ($http_user_agent = "") { return 403; } # 禁止下载文件 location ~* \.(zip|rar|gz|tar|7z|apk|doc|docx|xls|xlsx|ppt|pptx)$ { return 403; } # 错误页面 error_page 404 =200 /index.php; # 其他正常配置 location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1; } } ``` ``` apache # ------------------------------------------------------------------------------ # 1. 隐藏敏感文件 # ------------------------------------------------------------------------------ Require all denied # ------------------------------------------------------------------------------ # 2. 重写规则(Rewrite) # ------------------------------------------------------------------------------ RewriteEngine On # 禁止下载特定文件类型(如压缩包、文档) RewriteRule \.(zip|rar|gz|tar|7z|apk|docx?|xls|xlsx|pptx?)$ - [F,NC,L] # ------------------------------------------------------------------------------ # 3. 屏蔽垃圾蜘蛛(黑名单) # ------------------------------------------------------------------------------ # 定义需要屏蔽的 User-Agent 列表 SetEnvIfNoCase User-Agent "DotBot|MauiBot|MegaIndex|BLEXBot|Qwantify|SEMrush|Serpstatbot|hubspot|PhantomJS|Scrapy|Webdup|AcoonBot|AhrefsBot|Ezooms|EdisterBot|EC2LinkFinder|jikespider|Purebot|MJ12bot|WangIDSpider|WBSearchBot|Wotbox|xbfMozilla|Yottaa|Jorgee|SWEBot|spbot|TurnitinBot-Agent|mail.RU|perl|Wget|Xenu|ZmEu" BadBot # 使用 Require 指令替代旧版 Order/Deny/Allow # 允许所有访问,但拒绝 BadBot 环境变量 Require all granted Require not env BadBot # ------------------------------------------------------------------------------ # 4. 错误页面 # ------------------------------------------------------------------------------ # 处理 404 并返回 200 状态码 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?s=/$1 [L] # 设置状态码头部(可选) Header set X-Custom-Status "200" # 其他配置(如 ErrorDocument) ErrorDocument 404 /index.php # ------------------------------------------------------------------------------ # 5. 其他安全设置(可选) # ------------------------------------------------------------------------------ # 防止空 User-Agent 访问 SetEnvIfNoCase User-Agent "^$" BadBot # 防止常见爬虫工具(如 curl、Wget) SetEnvIfNoCase User-Agent "curl|Wget" BadBot ``` #### 标题加上前缀 **增加前缀文件** `data/prefix.txt` **添加处理逻辑** ``` php $titlemxs = file(DIR . '/data/title.txt'); $moban = str_replace('<云核_标题>', trim(varray_rand($titlemxs)), $moban); // 添加以下两行 $prefixs = file(DIR . '/data/prefix.txt'); $moban = str_replace('<云核_前缀>', trim(varray_rand($prefixs)), $moban); ``` #### 模板制作 - index.html - list.html - article.html - about.html - contact.html #### 切换主题 ``` // 设置模板 $template = "default"; // 模板名称 ``` #### 子目录模式 ``` // 工作模式 $logicroot = "yunhe"; // 如果不为空,则是子目录模式 ```