首页
关于我们
友链链接
壁纸下载
更多
统计中心
热点搜索
图床上传
Search
1
[Win DD包] wes7-x86-cn-精简,安装后仅占用1.55G存储空间
25,502 阅读
2
保姆级教程!甲骨文ARM DD成Debian10并升级内核成5.10
6,200 阅读
3
N1教程:Openwrt安装docker webui界面(基于flippy openwrt n1固件)
5,229 阅读
4
ZFAKA小店Docker版之 数据的备份和迁移
5,067 阅读
5
v2rayN基础使用教程、配置说明、添加订阅、路由选择
4,971 阅读
Linux学堂
网站建设
网络资源
主题插件
固件工具
主机评测
登录
Search
标签搜索
vps
typecho
linux
bench
mysql
cloudflare
nginx
lnmp
ssl
empirecms
openwrt
centos
google
docker
n1
301
qbittorrent
telegram
free
onedrive
V+变量
累计撰写
276
篇文章
累计收到
217
条评论
首页
栏目
Linux学堂
网站建设
网络资源
主题插件
固件工具
主机评测
页面
关于我们
友链链接
壁纸下载
统计中心
热点搜索
图床上传
搜索到
276
篇与
的结果
2025-03-07
openwrt挂载网站,让你的移动硬盘作为uhttpd挂载服务器
一前言之前本站介绍过,如何更改openwrt路由器的端口号,来解决电信、联通和移动运营商封禁家庭宽带端口号的文章:解决电信运营商封禁80和443端口,修改openwrt路由器的web访问端口号。今天介绍下如何将本地挂载的移动硬盘作为网站服务根目录,实现多端口访问。本文介绍了如何管理和配置uhttpd服务,包括启动、停止、重启和重新加载配置文件。通过修改/uetc/config/uhttpd配置,可以监听多个端口,并允许通过http://ip:8080/访问到特定目录。此外,还提到了CGI脚本的配置,如cgi_prefix和lua_prefix,以及/home、/key和/crt选项的作用。提供了多个相关脚本和资源链接供进一步学习。二配置教程1 SSH链接到旁路由2 编辑/ect/config/uhttpd文件vim /ect/config/uhttpd在其中增加如下的代码config uhttpd 'xboy' list listen_http '0.0.0.0:8080' list listen_http '[::]:8080' option home '/mnt/sda1/xboy' option cgi_prefix '/cgi-bin' option ubus_prefix '/ubus'注:上面代码中各参数的含义0.0.0.0:8080:表示监控IPV4的8080端口号; [::]:8080:表示监控IPV6的8080端口号; /mnt/sda1/xboy:设定的网站访问目录,比如移动硬盘下的xboy文件夹; /cgi-bin:cgi程序目录,如果是静态html可以不配置,cgi_prefix 定义了CGI脚本的前缀,该前缀相对应home路径,如果该字段为空,则cgi功能失效; lua_prefix 将请求转发给内置的Lua解析器,如果为空,则Lua功能失效; ubus_prefix ubus接线目录,如果为空,则ubus功能失效。3 让uhttpd加载配置文件/etc/init.d/uhttpd reload4 重启uhttpd程序/etc/init.d/uhttpd restart5 正常的话就可以用 http://路由器ip:8080访问了三注意事项1 uhttpd相关命令/etc/init.d/uhttpd start //启动uhttpd服务 /etc/init.d/uhttpd stop //停止uhttpd服务 /etc/init.d/uhttpd restart //重启uhttpd服务 /etc/init.d/uhttpd reload //重新加载uhttpd配置文件 /etc/init.d/uhttpd enable //启用uhttpd自动运行 /etc/init.d/uhttpd disable //停用uhttpd自动运行2 uhttpd的主配置文件config uhttpd 'main' list listen_http '0.0.0.0:80' list listen_http '[::]:80' list listen_https '0.0.0.0:443' list listen_https '[::]:443' option redirect_https '0' option home '/www' option rfc1918_filter '1' option max_connections '100' option cert '/etc/uhttpd.crt' option key '/etc/uhttpd.key' option cgi_prefix '/cgi-bin' list lua_prefix '/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua' option network_timeout '30' option http_keepalive '20' option tcp_keepalive '1' option ubus_prefix '/ubus' option script_timeout '3600' list index_page 'cgi-bin/luci' option max_requests '50'上述参数含义从字面容易理解,key为私钥,crt为公钥。3 其他参考资料http://news.netcraft.com/archives/2011/04/06/april-2011-web-server-survey.htmlhttps://forum.openwrt.org/search.php?search_id=1586996754http://wiki.openwrt.org/doc/uci/uhttpdhttp://wiki.openwrt.org/doc/howto/http.overviewhttp://en.wikipedia.org/wiki/Comparison_of_lightweight_web_servers 各种web服务器之比较
2025年03月07日
26 阅读
0 评论
0 点赞
2025-03-06
解决电信运营商封禁80和443端口,修改openwrt路由器的web访问端口号
前言由于众所周知的原因,国内电信运营商宽带会封禁家用宽带的80/443端口号,但是有时候又需要远程访问路由器,除了桥接光猫外,今天介绍直接修改openwrt路由器的web访问端口号的方法。在OpenWrt路由器上,如何修改Web访问端口号,通常涉及到修改HTTP服务器的配置文件。默认情况下,OpenWrt使用的HTTP服务器是uHTTPd。以下是修改Web访问端口号的步骤:一、通过SSH登录路由器:使用SSH客户端连接到路由器。如果你的路由器上没有安装SSH服务器,你可能需要通过Web界面或其他方式启用SSH。二、编辑uHTTPd配置文件:执行命令vi /etc/config/uhttpd以编辑uHTTPd的配置文件。找到下面的代码:config uhttpd 'main' list listen_http '0.0.0.0:80' list listen_http '[::]:80'按键盘I进入编辑模式,将其修改为config uhttpd 'main' list listen_http '0.0.0.0:8080' list listen_http '[::]:8080'按下esc,然后输入:wq,并按Enter保存并退出:三、重新启动uHTTPd服务:为了使更改生效,需要重新启动uHTTPd服务。执行以下命令:/etc/init.d/uhttpd restart或者使用service命令:service uhttpd restart如果你使用了防火墙,你可能还需要更新防火墙规则以允许新的端口上的流量。
2025年03月06日
70 阅读
2 评论
0 点赞
2025-03-05
X-UI的手动安装教程,解救自动安装失败的VPS
X-UI是一款非常优秀的科学工具,关于X-UI的特点、自动安装和使用教程,可以查看本站之前的文章:3x-ui安装指南+搭建reality+申请ssl证书。很多网友反馈采用自动脚本安装会失败,包括检测VPS内核、系统识别等等各种原因,其实github自动脚本install.sh中已经有了安装过程,今天就基于该脚本的解读,介绍下如何手动安装X-UI脚本:1 用SSH软件登录你的VPS2 打开/usr/local目录cd /usr/local/3 下载对应系统的压缩包wget -N https://github.com/MHSanaei/3x-ui/releases/download/v2.5.3/x-ui-linux-amd64.tar.gz4 解压,正常解压会产生一个x-ui的文件夹tar zxvf x-ui-linux-amd64.tar.gz5 打开上一步解压产生的x-ui文件夹,查看目录下的文件是否解压正常cd x-ui ls -a6 变更x-ui程序的权限chmod +x x-ui7 安装x-uibash ./x-ui.sh输入上述命令后,正常会弹出3x-ui的安装界面,选择1就是安装,如果安装过可以输入10查看目前安装的信息,记住安装的信息,然后通过浏览器登录,地址为 http://ip地址:端口号/面板路径,用户名和密码见快捷键10提供的当前配置信息:╔────────────────────────────────────────────────╗ │ 3X-UI Panel Management Script │ │ 0. Exit Script │ │────────────────────────────────────────────────│ │ 1. Install │ │ 2. Update │ │ 3. Update Menu │ │ 4. Legacy Version │ │ 5. Uninstall │ │────────────────────────────────────────────────│ │ 6. Reset Username & Password & Secret Token │ │ 7. Reset Web Base Path │ │ 8. Reset Settings │ │ 9. Change Port │ │ 10. View Current Settings │ │────────────────────────────────────────────────│ │ 11. Start │ │ 12. Stop │ │ 13. Restart │ │ 14. Check Status │ │ 15. Logs Management │ │────────────────────────────────────────────────│ │ 16. Enable Autostart │ │ 17. Disable Autostart │ │────────────────────────────────────────────────│ │ 18. SSL Certificate Management │ │ 19. Cloudflare SSL Certificate │ │ 20. IP Limit Management │ │ 21. Firewall Management │ │ 22. SSH Port Forwarding Management │ │────────────────────────────────────────────────│ │ 23. Enable BBR │ │ 24. Update Geo Files │ │ 25. Speedtest by Ookla │ ╚────────────────────────────────────────────────╝ Panel state: Stop Start automatically: Yes xray state: Stop Please enter your selection [0-25]: 18 激活x-ui的Servicecp -f x-ui.service /etc/systemd/system/ systemctl daemon-reload systemctl enable x-ui逐行输入9 启动x-ui Servicesystemctl start x-ui正常这个时候就可以正常使用了10 其他快捷命令systemctl stop x-ui systemctl restart x-ui systemctl status x-ui参考源程序#!/bin/bash red='\033[0;31m' green='\033[0;32m' blue='\033[0;34m' yellow='\033[0;33m' plain='\033[0m' cur_dir=$(pwd) # check root [[ $EUID -ne 0 ]] && echo -e "${red}Fatal error: ${plain} Please run this script with root privilege \n " && exit 1 # Check OS and set release variable if [[ -f /etc/os-release ]]; then source /etc/os-release release=$ID elif [[ -f /usr/lib/os-release ]]; then source /usr/lib/os-release release=$ID else echo "Failed to check the system OS, please contact the author!" >&2 exit 1 fi echo "The OS release is: $release" arch() { case "$(uname -m)" in x86_64 | x64 | amd64) echo 'amd64' ;; i*86 | x86) echo '386' ;; armv8* | armv8 | arm64 | aarch64) echo 'arm64' ;; armv7* | armv7 | arm) echo 'armv7' ;; armv6* | armv6) echo 'armv6' ;; armv5* | armv5) echo 'armv5' ;; s390x) echo 's390x' ;; *) echo -e "${green}Unsupported CPU architecture! ${plain}" && rm -f install.sh && exit 1 ;; esac } echo "arch: $(arch)" os_version="" os_version=$(grep "^VERSION_ID" /etc/os-release | cut -d '=' -f2 | tr -d '"' | tr -d '.') if [[ "${release}" == "arch" ]]; then echo "Your OS is Arch Linux" elif [[ "${release}" == "parch" ]]; then echo "Your OS is Parch Linux" elif [[ "${release}" == "manjaro" ]]; then echo "Your OS is Manjaro" elif [[ "${release}" == "armbian" ]]; then echo "Your OS is Armbian" elif [[ "${release}" == "alpine" ]]; then echo "Your OS is Alpine Linux" elif [[ "${release}" == "opensuse-tumbleweed" ]]; then echo "Your OS is OpenSUSE Tumbleweed" elif [[ "${release}" == "openEuler" ]]; then if [[ ${os_version} -lt 2203 ]]; then echo -e "${red} Please use OpenEuler 22.03 or higher ${plain}\n" && exit 1 fi elif [[ "${release}" == "centos" ]]; then if [[ ${os_version} -lt 8 ]]; then echo -e "${red} Please use CentOS 8 or higher ${plain}\n" && exit 1 fi elif [[ "${release}" == "ubuntu" ]]; then if [[ ${os_version} -lt 2004 ]]; then echo -e "${red} Please use Ubuntu 20 or higher version!${plain}\n" && exit 1 fi elif [[ "${release}" == "fedora" ]]; then if [[ ${os_version} -lt 36 ]]; then echo -e "${red} Please use Fedora 36 or higher version!${plain}\n" && exit 1 fi elif [[ "${release}" == "amzn" ]]; then if [[ ${os_version} != "2023" ]]; then echo -e "${red} Please use Amazon Linux 2023!${plain}\n" && exit 1 fi elif [[ "${release}" == "debian" ]]; then if [[ ${os_version} -lt 11 ]]; then echo -e "${red} Please use Debian 11 or higher ${plain}\n" && exit 1 fi elif [[ "${release}" == "almalinux" ]]; then if [[ ${os_version} -lt 80 ]]; then echo -e "${red} Please use AlmaLinux 8.0 or higher ${plain}\n" && exit 1 fi elif [[ "${release}" == "rocky" ]]; then if [[ ${os_version} -lt 8 ]]; then echo -e "${red} Please use Rocky Linux 8 or higher ${plain}\n" && exit 1 fi elif [[ "${release}" == "ol" ]]; then if [[ ${os_version} -lt 8 ]]; then echo -e "${red} Please use Oracle Linux 8 or higher ${plain}\n" && exit 1 fi elif [[ "${release}" == "virtuozzo" ]]; then if [[ ${os_version} -lt 8 ]]; then echo -e "${red} Please use Virtuozzo Linux 8 or higher ${plain}\n" && exit 1 fi else echo -e "${red}Your operating system is not supported by this script.${plain}\n" echo "Please ensure you are using one of the following supported operating systems:" echo "- Ubuntu 20.04+" echo "- Debian 11+" echo "- CentOS 8+" echo "- OpenEuler 22.03+" echo "- Fedora 36+" echo "- Arch Linux" echo "- Parch Linux" echo "- Manjaro" echo "- Armbian" echo "- AlmaLinux 8.0+" echo "- Rocky Linux 8+" echo "- Oracle Linux 8+" echo "- OpenSUSE Tumbleweed" echo "- Amazon Linux 2023" echo "- Virtuozzo Linux 8+" exit 1 fi install_base() { case "${release}" in ubuntu | debian | armbian) apt-get update && apt-get install -y -q wget curl tar tzdata ;; centos | almalinux | rocky | ol) yum -y update && yum install -y -q wget curl tar tzdata ;; fedora | amzn | virtuozzo) dnf -y update && dnf install -y -q wget curl tar tzdata ;; arch | manjaro | parch) pacman -Syu && pacman -Syu --noconfirm wget curl tar tzdata ;; opensuse-tumbleweed) zypper refresh && zypper -q install -y wget curl tar timezone ;; *) apt-get update && apt install -y -q wget curl tar tzdata ;; esac } gen_random_string() { local length="$1" local random_string=$(LC_ALL=C tr -dc 'a-zA-Z0-9' </dev/urandom | fold -w "$length" | head -n 1) echo "$random_string" } config_after_install() { local existing_username=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'username: .+' | awk '{print $2}') local existing_password=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'password: .+' | awk '{print $2}') local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}') local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}') local server_ip=$(curl -s https://api.ipify.org) if [[ ${#existing_webBasePath} -lt 4 ]]; then if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then local config_webBasePath=$(gen_random_string 15) local config_username=$(gen_random_string 10) local config_password=$(gen_random_string 10) read -p "Would you like to customize the Panel Port settings? (If not, a random port will be applied) [y/n]: " config_confirm if [[ "${config_confirm}" == "y" || "${config_confirm}" == "Y" ]]; then read -p "Please set up the panel port: " config_port echo -e "${yellow}Your Panel Port is: ${config_port}${plain}" else local config_port=$(shuf -i 1024-62000 -n 1) echo -e "${yellow}Generated random port: ${config_port}${plain}" fi /usr/local/x-ui/x-ui setting -username "${config_username}" -password "${config_password}" -port "${config_port}" -webBasePath "${config_webBasePath}" echo -e "This is a fresh installation, generating random login info for security concerns:" echo -e "###############################################" echo -e "${green}Username: ${config_username}${plain}" echo -e "${green}Password: ${config_password}${plain}" echo -e "${green}Port: ${config_port}${plain}" echo -e "${green}WebBasePath: ${config_webBasePath}${plain}" echo -e "${green}Access URL: http://${server_ip}:${config_port}/${config_webBasePath}${plain}" echo -e "###############################################" echo -e "${yellow}If you forgot your login info, you can type 'x-ui settings' to check${plain}" else local config_webBasePath=$(gen_random_string 15) echo -e "${yellow}WebBasePath is missing or too short. Generating a new one...${plain}" /usr/local/x-ui/x-ui setting -webBasePath "${config_webBasePath}" echo -e "${green}New WebBasePath: ${config_webBasePath}${plain}" echo -e "${green}Access URL: http://${server_ip}:${existing_port}/${config_webBasePath}${plain}" fi else if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then local config_username=$(gen_random_string 10) local config_password=$(gen_random_string 10) echo -e "${yellow}Default credentials detected. Security update required...${plain}" /usr/local/x-ui/x-ui setting -username "${config_username}" -password "${config_password}" echo -e "Generated new random login credentials:" echo -e "###############################################" echo -e "${green}Username: ${config_username}${plain}" echo -e "${green}Password: ${config_password}${plain}" echo -e "###############################################" echo -e "${yellow}If you forgot your login info, you can type 'x-ui settings' to check${plain}" else echo -e "${green}Username, Password, and WebBasePath are properly set. Exiting...${plain}" fi fi /usr/local/x-ui/x-ui migrate } install_x-ui() { cd /usr/local/ if [ $# == 0 ]; then tag_version=$(curl -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') if [[ ! -n "$tag_version" ]]; then echo -e "${red}Failed to fetch x-ui version, it may be due to GitHub API restrictions, please try it later${plain}" exit 1 fi echo -e "Got x-ui latest version: ${tag_version}, beginning the installation..." wget -N -O /usr/local/x-ui-linux-$(arch).tar.gz https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz if [[ $? -ne 0 ]]; then echo -e "${red}Downloading x-ui failed, please be sure that your server can access GitHub ${plain}" exit 1 fi else tag_version=$1 tag_version_numeric=${tag_version#v} min_version="2.3.5" if [[ "$(printf '%s\n' "$min_version" "$tag_version_numeric" | sort -V | head -n1)" != "$min_version" ]]; then echo -e "${red}Please use a newer version (at least v2.3.5). Exiting installation.${plain}" exit 1 fi url="https://github.com/MHSanaei/3x-ui/releases/download/${tag_version}/x-ui-linux-$(arch).tar.gz" echo -e "Beginning to install x-ui $1" wget -N -O /usr/local/x-ui-linux-$(arch).tar.gz ${url} if [[ $? -ne 0 ]]; then echo -e "${red}Download x-ui $1 failed, please check if the version exists ${plain}" exit 1 fi fi if [[ -e /usr/local/x-ui/ ]]; then systemctl stop x-ui rm /usr/local/x-ui/ -rf fi tar zxvf x-ui-linux-$(arch).tar.gz rm x-ui-linux-$(arch).tar.gz -f cd x-ui chmod +x x-ui # Check the system's architecture and rename the file accordingly if [[ $(arch) == "armv5" || $(arch) == "armv6" || $(arch) == "armv7" ]]; then mv bin/xray-linux-$(arch) bin/xray-linux-arm chmod +x bin/xray-linux-arm fi chmod +x x-ui bin/xray-linux-$(arch) cp -f x-ui.service /etc/systemd/system/ wget -O /usr/bin/x-ui https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh chmod +x /usr/local/x-ui/x-ui.sh chmod +x /usr/bin/x-ui config_after_install systemctl daemon-reload systemctl enable x-ui systemctl start x-ui echo -e "${green}x-ui ${tag_version}${plain} installation finished, it is running now..." echo -e "" echo -e "┌───────────────────────────────────────────────────────┐ │ ${blue}x-ui control menu usages (subcommands):${plain} │ │ │ │ ${blue}x-ui${plain} - Admin Management Script │ │ ${blue}x-ui start${plain} - Start │ │ ${blue}x-ui stop${plain} - Stop │ │ ${blue}x-ui restart${plain} - Restart │ │ ${blue}x-ui status${plain} - Current Status │ │ ${blue}x-ui settings${plain} - Current Settings │ │ ${blue}x-ui enable${plain} - Enable Autostart on OS Startup │ │ ${blue}x-ui disable${plain} - Disable Autostart on OS Startup │ │ ${blue}x-ui log${plain} - Check logs │ │ ${blue}x-ui banlog${plain} - Check Fail2ban ban logs │ │ ${blue}x-ui update${plain} - Update │ │ ${blue}x-ui legacy${plain} - legacy version │ │ ${blue}x-ui install${plain} - Install │ │ ${blue}x-ui uninstall${plain} - Uninstall │ └───────────────────────────────────────────────────────┘" } echo -e "${green}Running...${plain}" install_base install_x-ui $1
2025年03月05日
63 阅读
1 评论
0 点赞
2025-03-03
大盘鸡VPS也能安装飞牛OS教程——新手5步实现Debian11安装飞牛OS教程
一 前言最近香港大盘鸡VPS卷起来了,像之前的Cnfaster,以及最近的VPS.town,都推出了仅收第一次硬盘配置费+每年固定240费用,5G带宽不要太快,折算下来非常划算,只要不跑路,这价格作为私人存储或者PT都是非常好的。配置费用明细 时长:年 HK$240.00 国家:中国香港 HK$0.00 CPU:2核 HK$0.00 内存:2048MB HK$0.00 系统盘:4000GB HK$480.00 流量:5000G HK$0.00 带宽:5000Mbps HK$0.00 IPv6数量:1个 HK$0.00 操作系统:Debian-12.0_x64 HK$0.00 合计费用: HK$720.00CNFaster的注册地址。进入地址后选择 云服务器-HKL Storage Special ,之后就可以自行配置需要的CPU、内存和硬盘容量了,我选择的是4t,大家可以按需选择。二 安装飞牛OS教程系统是基于Debian11 DD的系统第一步,打开你的SSH工具,连接你的Cnfaster的HK大盘鸡!第二步,使用bin456789大佬的DD脚本项目地址:https://github.com/bin456789/reinstall 不放心的可以去看一下项目,脚本如下:curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O reinstall.sh $_第三步,看到完成提示后,输入如下命令运行脚本bash reinstall.sh fnos输入你需要设置的密码,和fnos系统盘的大小最小默认是8G,由于我的系统盘是40G,所以我设置得大一点,设置为20G第四步,回车执行后等待脚本跑完跑完会有提示,提示你可以输入命令:reboot开启重装脚本跑完会有类似界面第五步,访问FNOS后台输入访问FNOS后台 例如你的IP是123.123.123.123 那后台地址就是 http://123.123.123.123:5666成功安装!后续就是设置你的密码啦,教程到此结束!
2025年03月03日
38 阅读
1 评论
0 点赞
2025-03-02
Typecho模板基础制作教程:常用调用代码
这篇日志非常全面地总结了 Typecho 模板中常用的调用代码,涵盖了站点标题、文章循环、分页、文章内容、作者信息、标签、分类、评论等各个方面。对于 Typecho 新手来说,这份代码清单无疑是非常有用的,可以帮助他们快速上手并搭建出美观实用的博客网站。1站点动态标题<?php $this->archiveTitle(array( 'category'=>_t('分类 %s 下的文章'), 'search'=>_t('包含关键字 %s 的文章'), 'tag' =>_t('标签 %s 下的文章'), 'author'=>_t('%s 的主页') ), '', ' - '); ?>2站点地址,名称与描述<?php $this->options->siteUrl(); ?>//站点地址 <?php $this->options->title(); ?>//名称 <?php $this->options->description() ?>//描述3index.php文章循环输出<?php if ($this->have()): ?>//判断文章存在与否 <?php while($this->next()): ?>//开始循环 <a href="<?php $this->permalink() ?>"><?php $this->title() ?></a>//文章标题和超链接 <a href="<?php $this->author->permalink(); ?>"><?php $this->author(); ?></a>//作者名称和超链接 <?php $this->date('F j, Y'); ?>//文章发布时间 <?php $this->category(','); ?>//文章分类 <?php $this->commentsNum('%d Comments'); ?>//评论数量 <?php $this->content('Continue Reading...'); ?>//阅读全文more语法截取缩略内容(可改为<?php $this->excerpt(140,'....'); ?>自动截取前140个字符,根据需要也可以改成 <?php $this->summary(); ?新版功能,自动输出内容中第一个块级元素中的内容>) <?php endwhile; ?>//循环结束 <?php else: ?>暂无与之相关文章<?php endif; ?>//判断结束4翻页代码<?php $this->pageNav('上一页', '下一页', '5', '……'); ?>//显示多个页码的 <?php $this->pageLink('下一页','next'); ?> <?php $this->pageLink('上一页'); ?>//只显示上一页下一页5页码显示当前页码:<?php if($this->_currentPage>1) echo $this->_currentPage; else echo 1;?> 总页码:<?php echo ceil($this->getTotal() / $this->parameter->pageSize); ?>6文章全文显示<?php $this->content(); ?>7登陆判断<?php if($this->user->hasLogin()):?> 登陆才可以看到这里的内容 <?php endif;?>8文章作者名称与主页地址<a href="<?php $this->author->permalink(); ?>"><?php $this->author(); ?></a>9文章最后编辑时间<?php echo gmdate('Y-m-d H:i', $this->modified + Typecho_Widget::widget('Widget_Options')->timezone); ?>10当前文章id<?php $this->cid(); ?>11文章中的上一篇和下一篇上一篇: <?php $this->thePrev('%s','没有了'); ?> 下一篇: <?php $this->theNext('%s','没有了'); ?>12文章标签<?php $this->tags(', ', true, 'none'); ?>说明:(', ', true, 'none')第一个单引号间的逗号代表标签与标签的间隔用逗号隔开,true是标签以超链接形式输出,none为该文章没有标签时显示的提示信息。13用户昵称<?php $this->user->screenName(); ?>14后台地址与登陆地址<?php $this->options->adminUrl(); ?>//后台地址 <?php $this->options->adminUrl('login.php'); ?>//登陆地址15分类描述<?php echo $this->getDescription(); ?>16标签相关文章<?php $this->related(5)->to($relatedPosts); ?> <ul> <?php while ($relatedPosts->next()): ?> <li><a href="<?php $relatedPosts->permalink(); ?>" title="<?php $relatedPosts->title(); ?>"><?php $relatedPosts->title(); ?></a></li> <?php endwhile; ?> </ul>17调用某分类文章,pageSize是数量,mid是分类号:<?php $this->widget('Widget_Archive@index', 'pageSize=6&type=category', 'mid=47′) ->parse('<li><a href="{permalink}">{title}</a></li>'); ?>18首行缩进问题,加入css实现.post-content p{ text-indent: 2em; /*em是相对单位,2em即现在一个字大小的两倍*/ } 19最新文章<?php $this->widget('Widget_Contents_Post_Recent')->to($post); ?> <?php while($post->next()): ?> <a href=”<?php $post->permalink(); ?>” title=”<?php $post->title(); ?>”> <?php $post->title(25, '…'); ?></a> <?php endwhile; ?>20神奇的is语法<?php if ($this->is('post')) : ?> 这里就是内容了 <?php endif; ?> typecho可以使用is语法判断很多东西,比如 $this->is('index'); $this->is('archive'); $this->is('single'); $this->is('page'); $this->is('post'); $this->is('category'); $this->is('tag'); 甚至是 $this->is('category', 'default'); $this->is('page', 'start'); $this->is('post', 1); 判断为当前页的第几篇文章,并单独输出内容 <?php if ($this->sequence == 0): ?> //需要的插入 <?php endif; ?>21总访问量1) 首先,在functions.php里加入如下代码://门前大路上,走过一群小伙伴,快来数一数:2,4,6,7,8…… function theAllViews() { $db = Typecho_Db::get(); $row = $db->fetchAll('SELECT SUM(VIEWS) FROM `typecho_contents`'); echo number_format($row[0]['SUM(VIEWS)']); }2) 然后用下面代码调用:<?php echo theAllViews();?>例如:你是第<?php echo theAllViews();?>位相遇的小伙伴2网站运行时间1) PHP调用首先,在functions.php里加入如下代码:// 设置时区 date_default_timezone_set('Asia/Shanghai'); /** * 秒转时间,格式 年 月 日 时 分 秒 * */ function getBuildTime() { // 在下面按格式输入本站创建的时间 $site_create_time = strtotime('2019-06-23 00:00:00'); $time = time() - $site_create_time; if (is_numeric($time)) { $value = array( "years" => 0, "days" => 0, "hours" => 0, "minutes" => 0, "seconds" => 0, ); if ($time >= 31556926) { $value["years"] = floor($time / 31556926); $time = ($time % 31556926); } if ($time >= 86400) { $value["days"] = floor($time / 86400); $time = ($time % 86400); } if ($time >= 3600) { $value["hours"] = floor($time / 3600); $time = ($time % 3600); } if ($time >= 60) { $value["minutes"] = floor($time / 60); $time = ($time % 60); } $value["seconds"] = floor($time); echo '<span class="btime">'.$value['years']. '年'.$value['days']. '天'.$value['hours']. '小时'.$value['minutes']. '分</span>'; } else { echo ''; } }然后用下面代码调用:<?php getBuildTime(); ?>2) JS调用直接在模板文件里添加以下两种样式的任意一种样式一本站已安全运行: <span id="momk"></span> <script language=javascript> function show_date_time(){ window.setTimeout("show_date_time()", 1000); BirthDay=new Date("05-06-2016 12:12:24");//建站日期 today=new Date(); timeold=(today.getTime()-BirthDay.getTime()); sectimeold=timeold/1000 secondsold=Math.floor(sectimeold); msPerDay=24*60*60*1000 e_daysold=timeold/msPerDay daysold=Math.floor(e_daysold); e_hrsold=(daysold-e_daysold)*-24; hrsold=Math.floor(e_hrsold); e_minsold=(hrsold-e_hrsold)*-60; minsold=Math.floor((hrsold-e_hrsold)*-60); seconds=Math.floor((minsold-e_minsold)*-60); momk.innerHTML=daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒" ; } show_date_time(); </script> <style> #momk{animation:change 10s infinite;font-weight:800; } @keyframes change{0%{color:#5cb85c;}25%{color:#556bd8;}50%{color:#e40707;}75%{color:#66e616;}100% {color:#67bd31;}} </style>样式二<span id="momk"></span><span id="momk" style="color: #ff0000;"></span> <script type="text/javascript"> function NewDate(str) { str = str.split('-'); var date = new Date(); date.setUTCFullYear(str[0], str[1] - 1, str[2]); date.setUTCHours(0, 0, 0, 0); return date; } function momxc() { var birthDay =NewDate("2016-5-6"); var today=new Date(); var timeold=today.getTime()-birthDay.getTime(); var sectimeold=timeold/1000 var secondsold=Math.floor(sectimeold); var msPerDay=24*60*60*1000; var e_daysold=timeold/msPerDay; var daysold=Math.floor(e_daysold); var e_hrsold=(daysold-e_daysold)*-24; var hrsold=Math.floor(e_hrsold); var e_minsold=(hrsold-e_hrsold)*-60; var minsold=Math.floor((hrsold-e_hrsold)*-60); var seconds=Math.floor((minsold-e_minsold)*-60).toString(); document.getElementById("momk").innerHTML = "本站已安全运行"+daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒"; setTimeout(momxc, 1000); }momxc(); </script> <style> #momk{animation:change 10s infinite;font-weight:800; } @keyframes change{0%{color:
2025年03月02日
20 阅读
0 评论
0 点赞
2025-03-02
Azure免费VPS服务及用量注意点集合,避免扣费暗坑
前言Azure提供了长达12个月的免费试用服务和永久免费的服务,但实际上免费机制存在着很多扣费暗坑,如果稍不注意,一个配置写错,就会引起较高的扣费。这篇文章统计了几乎所有的暗坑,提请大家注意。之前介绍过如何申请Azure免费主机:1.白嫖微软Azure VPS免费12个月+$200 额度+永久免费(25+项服务)一:12个月免费服务的注意事项(1)$200免费额度只有一个月咋一看官网,一般会以为$200免费额度和12个月免费用量都是12个月。但是实际上仔细看,$200免费额度是会在30天后失效的。P.S.学生订阅$100额度是12个月。(2)升级即用即付时支持计划收费申请免费试用的30天内,需要把订阅升级到即用即付,才能继续免费用一年。但是在升级过程中,有一个Dev Support Plan是默认勾选的,需要去掉,否则会直接从卡中扣费。(3)两台免费VPS,必须都是B1s,其他机型收费参考一下Azure免费门户可以看到。只有B1s类型免费。(4)两台B1s,必须是一台Win一台Linux这里有一个坑,就是创建Win的时候,下面这个选项不可以选,否则这一台Win会作为Linux来算。(图1)P.S.这个规则也可以被利用,比如说喜欢挂机的同学可以通过其中一台勾选这个选项的方法开出两台免费Win。(5)系统是Win还是Linux,是按实时监测的结果算的不可以DD系统,DD以后会按照DD之后的系统算。建议选Win2012R2系统,内存还能撑。建议开启虚拟内存。(6)两块免费硬盘必须都是64G一般来讲,国内的云服务,“VM”这个概念中应该就已经包括硬盘了。但实际上Azure并不包括,在免费门户可以看到,额外标注了两块硬盘的使用量,也是有限制的。B1s创建出来默认是30G硬盘,这里要先关机再改64G,小于64G也是会扣费的。P.S.Win系统硬盘默认130G,而硬盘创建后只可以向上扩不能向下减。创建时,Win系统需要选带[smalldisk]标签的镜像。(7)硬盘性能的限制“64GB硬盘免费”只是一个习惯性的说法,因为有一个推荐选项是“64GB+P6”,如果你是手动输入的“64GB”而不是从列表中选择推荐选项,还需要再手动改性能为“P6”,否则还是会扣费。(8)硬盘改64G后,Win系统下不会自动扩充分区大小需要到“计算机管理”下手动扩大分区大小。(9)首年免费流量每月15G,然后每月5G又一个坑:是两台VPS一共15G,不是各15G。仅针对VM而言,Web Apps不计入。(10)只有动态IP免费两台VPS没有静态IP,关机时会出现下面这样的提示,勾选“保留IP”就会收费。(图2)但是,可以免费创建一个"*.datacenter.cloudapp.azure.com"格式的CNAME地址,如果建站的话,DNS记录不要设A记录,CNAME到这个地址就行了。设置方法:打开自己的虚拟机,选这个选项:(图3)然后在这里设置:(图4)二:永久免费用量的注意事项(1)Web Apps针对主机的限制有10个Web App是永久免费的,但是Linux App必须运行于同一主机上,也就是必须在同一Datacenter,如果超出1个Datacenter就会收费。Windows App则无此限制。三 其他注意事项(1)虚拟机的映像不要选错,一定要是免费的那几种(2)IP地址要选动态的不要静态的否则收费(3)磁盘一定要是P6 64G的否则收费(4)蛮多注意事项,让人有点紧张,担心没有用上免费的反而被套路的。后面发现有个很方便的入口,直接无脑创建就行了,以上问题都不存在。免费虚拟机便捷创建入口:直接从下面两个入口进入创建流程就行了,两个操作系统的入口不同。linux:https://portal.azure.com/#create/microsoft.freeaccountvirtualmachine-linuxwindows:https://portal.azure.com/#create/microsoft.freeaccountvirtualmachine-windows
2025年03月02日
26 阅读
1 评论
0 点赞
2025-03-02
白嫖微软Azure VPS免费12个月+$200 额度+永久免费(25+项服务)
一 前言Azure,微软旗下,专业提供的云计算服务,其虚拟机(VPS)有全球多个数据中心,特别是香港,大带宽,国内速度优秀。现在有12个月的免费服务,可创建Linux和Windows VPS。vps免费资源为1G内存/64G空间/15G月流量,持续一年。首月送200美金,15G流量不能随意用。注册无门槛,全中文,主要是需要visa/master信用卡验证,手机验证(国内电话可以)。活动地址:https://azure.microsoft.com/zh-cn/free/管理面板https://portal.azure.com/免费内容:首月送200美金,10T流量随意用。其余的免费资源在在网页上浏览吧。浏览任何 Azure 服务 30 天!vps免费资源为1G内存/40G空间/15G月流量,持续一年。享受Azure免费12个月试用的限制套路很多,大家一定要留意了。实在不会用就删掉吧。需要试用完200美元或者过了30天后,必须升级即用即付后,才能享受12个月免费服务。免费12个月期间,如果产生扣费(比如流量超了)会在下个月账单中直接信用卡扣费。免费12个月到期后,订阅不会停止,已开通的免费资源会直接产生扣费二 注册0准备工作一个微软账号(没有就注册一个)一张信用卡,验证卡的时候扣费1美刀!(VISA或者万事达,且没有激活过其他账号)一个手机号,国内香港皆可(本文演示使用的是国内号码)注册步骤:1、创建账户填写注册信息,邮箱可以是163,填写以下信息,如图:2、手机验证通过手机号接收一个验证码!如图:3、验证信用卡(新绑卡会扣费1刀)信用卡用来验证你的身份并屏蔽垃圾邮件和自动程序。除非升级,否则不会收取你的费用。4、协议同意协议,点击注册就可以注册成功了。5、注册账号成功我们可以看到赠送的200刀,如图:6、创建虚拟机创建运行 Linux 或 Windows 的虚拟机。从市场中选择映像,或使用自定义的映像。7、选择区域Azure的多有数据中心如下:s美国东部(美国)美国东部2(美国)美国西部2(美国)美国中南部(美国)美国西部(美国)美国中北部(美国)美国中部(非洲)南非北部(亚太)澳大利亚东部(亚太)东亚(亚太) 是香港东南亚(亚太) 是新加坡韩国中部(亚太)日本东部(亚太)印度中部(加拿大)加拿大中部(欧洲)北欧(欧洲)西欧(欧洲)英国南部(欧洲)法国中部(南美洲)巴西南部[/p]8、标准 B1s选择配置的时候一定要选择标准 B1s这个配置,大鸟这里的数据中心选择的香港,如图:9、选择高级SSD磁盘选择高级SSD即可!如图:10、网络公用ip会自动分配,如图:11、关掉监控这一步,会开启服务器监控,我们选择全部关掉,当然你也可以默认,如图:12、验证通过高级和标记这里都默认吧,终于创建成功了,如图:13、创建成功建个虚拟机真是难啊,创建成功如图:开放端口14、点击网络虚拟机概要信息,点击【网络】15、端口规则点击,添加入站端口规则,如图:16、添加入站安全规则优先级设置到最高100!目标端口访问填写‘*’表示允许多有端口,如图:17、ping这样就可以ping通了,如图:三 常见问题:遇到的一些问题,可以看这里:1切换root用户登陆服务器后直接使用 sudo -i 切换到 root,如图:2删除机器如果开错数据中心,删除虚拟机,可以这样,看图:3开始使用 Azure 免费帐户时需要付费吗?不。开始时免费,并且还将获得 $200 信用额度,用户可在前 30 天使用这些信用额度。$200 的免费信用额度用完或 30 天到期后会发生什么情况?我们将发送通知,以便用户能够决定是否升级为即用即付定价并移除支出限制。如果决定升级,便可继续访问所有免费产品。如果决定不升级,将禁用你的帐户和产品,你需要升级才可继续使用。免费产品 12 个月的使用期结束时,将发生什么情况?自升级帐户起的 12 个月内可免费使用某些常用产品的部分功能(如计算、网络、存储和数据库)。12 个月之后,这些产品仍继续正常运行,但它们将按标准即用即付费率收费。注册免费帐户需要提供什么?仅需提供电话号码、信用卡和 GitHub 帐户或 Microsoft 帐户用户名(以前称为 Windows Live ID)。4虚拟机配置配置如下:sCPU: 1核内存:1G磁盘:64G虚拟:hypervIP数:1IPv4带宽:G口带宽流量:15G(账号共享)系统:Linux,Windows数据中心:香港[/p]5预付费扣除申请的时候,短信显示扣了一个7元和一个1美元,还没有退回,听别的大佬说这是预授权,下次账单就恢复额度了。6 其他事项需要注意的是,前一个月是有200刀的所以你需要密切观察是否有产生费用服务,如果有产生费用就赶紧删除。关于其他避坑问题,可以参考本站文章:Azure免费VPS服务及用量注意点集合,避免扣费暗坑
2025年03月02日
34 阅读
1 评论
0 点赞
2025-03-01
纯血鸿蒙系统如何安装电报、推特、Tiktok和油管APP
0 前言鸿蒙系统Harmonyos是华为开放的一款跨终端操作系统,其中手机操作系统最新版为Harmony next5.0,因其流畅高效而著称,目前唯一不足的是软件生态不够完整,特别是一些科学软件。前面本站介绍过如何在鸿蒙next下通过安装器安装第三方软件,以及如何安装Clash Meta实现科学上网,具体可以参考:1.让鸿蒙也能自由安装应用,小白鸿蒙开源自助餐图文教程2.鸿蒙Next也能科学上网?Clash Meta for harmorny next os上面两篇教程是本文的基础,建议第一次接触的网友先阅读,今天的教程是在实现科学后,如何纯血鸿蒙系统如何安装电报、推特、Tiktok和油管APP。1 下载对应的hap应用安装包目前电报、推特、Tiktok和油管APP是通过侧载应用的方式安装到鸿蒙系统的,实际上是网页封装形式,但不影响使用,相应的hap安装包我放到123云盘,可以自取:应用下载地址备用地址推特xhttps://www.123684.com/s/jiEmjv-It0xd提取码:9ucOhttps://www.123912.com/s/jiEmjv-It0xd提取码:9ucOYoutubehttps://www.123684.com/s/jiEmjv-Mt0xd提取码:cblOhttps://www.123912.com/s/jiEmjv-Mt0xd提取码:cblOTelegramhttps://www.123684.com/s/jiEmjv-wt0xd提取码:wEM5https://www.123912.com/s/jiEmjv-wt0xd提取码:wEM5Tiktokhttps://www.123684.com/s/jiEmjv-gt0xd提取码:PJNYhttps://www.123912.com/s/jiEmjv-gt0xd提取码:PJNY解压密码:www.vvars.com2 电脑打开鸿蒙安装器,将下载的hap拖入上传框(或者点击“单击上传”选择hap安装包),手机通过数据线连接到电脑(手机记得的打开调试模式)3 点击 开始创建,会提示登录华为账号,授权,然后下一步,最后提示安装成功4 手机上打开使用电报、推特、Tiktok和油管APP安装过程是一样的,接下来快乐冲浪吧。
2025年03月01日
619 阅读
7 评论
0 点赞
2025-03-01
让鸿蒙也能自由安装应用,小白鸿蒙开源自助餐图文教程
0 前言鸿蒙系统Harmonyos是华为开放的一款跨终端操作系统,其中手机操作系统最新版为Harmony next5.0,因其流畅高效而著称,目前唯一不足的是软件生态不够完整,特别是一些科学软件。在完成本文的鸿蒙安装器后,可以通过安装科学软件和外网APP实现上网,关于如何安装Clash Meta实现科学上网及外网APP安装,具体可以参考:1.鸿蒙Next也能科学上网?Clash Meta for harmorny next os2.纯血鸿蒙系统如何安装电报、推特、Tiktok和油管APP1. 进入鸿蒙安装器下载网站(建议打开科/学),为小白鸿蒙开源自助餐项目,(可小星星关注此项目,下次能快速找到项目关注更新)找到网站中releases最新版本(如下图),点进去。2.下载最新版本中的.exe文件(win系统),目前最新版本为1.2.43.双击安装4.安装后,打开此软件5.可将hap安装包直接拖入,或者点击“单击上传”选择hap安装包6. next系统手机/平板设备,打开开发者模式(设置如下图位置,多次点击“软件版本”打开开发者模式,会重启)7.进入设置—系统—开发者选项,打开“usb调试”,线连手机和电脑8.点击“开始构建”,并点击“下一步”(无需安装docker)9.弹出登录华为账号窗口,输入自己的华为账号登录即可10.点击下一步,直到安装成功最后,为了不方便科学的网友,还是放个123云盘链接吧网盘地址提取码123云盘https://www.123684.com/s/jiEmjv-ot0xd https://www.123912.com/s/jiEmjv-ot0xdLm9U
2025年03月01日
193 阅读
2 评论
1 点赞
2025-02-28
节省本地硬盘空间,让OneDrive显示在线文件而不占用硬盘空间
Windows 10开始,微软为其配备了新的OneDrive,同时同步逻辑也大大改变。以往在Windows 8.1,可以设置那些文件脱机可用,那些文件只显示一个“快捷方式”一样的图标,真正在使用的时候再下载就可以。而安装了Windows 10之后,OneDrive一开始便要用户选择要同步的OneDrive文件夹,而且是之后同步到本地的文件才可以看到并使用,没有同步的文件根本看不到。说实话这是极大的退步,而且本来用来节约本地空间的同步功能,反而占用大量空间。现在有一个方法,可以让Windows 10上的OneDrive使用像Windows 8.1一样的同步逻辑,让用户浏览所有OneDrive文件的同时,不占用系统硬盘空间。步骤如下:1 转到网址https://onedrive.live.com/,使用自己的outlook账号登陆。国内将outlook网页封锁了,可能需要特殊姿势才能登陆。登录OneDrive2 随便打开一个文件夹。比如图中的Documents。注意地址栏中地址的变化。打开文件夹3 复制地址栏中,“?id=”之后,“%”之前的部分。复制地址栏4 打开“此电脑”(就是资源管理器),注意一定在“此电脑”的状态下,而不是资源管理器的默认状态下(能看到分区)。点击标题栏附近的“计算机”标签,然后点击“映射网络驱动器”。映射网络驱动器5 在弹出窗口中,可与选择映射的驱动器盘符,然后在“文件夹”中输入:https://d.docs.live.net/刚才复制的“?id=”后的部分,如https://d.docs.live.net/9797868713D3984E。下面两个选项也一并勾选。点击完成。设置映射网络驱动器5 系统会提示正在尝试连接到OneDrive,稍等片刻。正在尝试连接6 系统会弹出窗口,要求输入outlook账号和密码。输入邮箱地址和密码即可,同时勾选“记住我的凭据”。输入完毕,点击确定。输入登录凭据7 稍等片刻,会在“此电脑”中显示连接好的OneDrive,位于“网络位置”标签下。连接成功8 可以选择,右键,重命名为一个好记的名称,如“OneDrive”。双击添加的盘符,可以进入整个OneDrive文件夹,国内速度有些慢,但是可以使用。这时候,就获得了所有OneDrive的文件,而不用将文件同步到本地硬盘中,节约了大量空间。
2025年02月28日
17 阅读
0 评论
0 点赞
1
...
5
6
7
...
28