零元建站还要VPS?你想多了 | Free Hosting, Zero Bills, Big Dreams

不用买服务器,也不用先掏钱包。一个永久免费 PHP 主机负责网站,一个 AWS 免费额度负责真正的 VPS 和 SSH。唯一的小脾气是 AWS 只有 6 个月免费期,但足够你把网站、Linux、SSH 和云计算一次玩明白。
You don’t need to buy a server or empty your wallet first. InfinityFree hosts the website, while AWS credits power a real VPS with SSH. AWS’s free period is only six months, but that’s plenty of time to build, test, learn, and have some fun.


完整实操

例子:做一个免费的个人技术状态网站,InfinityFree负责公网 PHP 网站,AWS Lightsail 免费额度负责一个真正的 Ubuntu VPS,并让 VPS 定时检测网站状态。/Example: build a free personal tech-status website, with InfinityFree hosting the public PHP site and an AWS Lightsail VPS running Ubuntu to monitor it automatically.

  1. 准备 Mac 环境/Prepare the Mac environment
    Mac 用户只需要 Safari 或 Chrome、Terminal 和一个邮箱即可开始。/Mac users only need Safari or Chrome, Terminal, and an email address to start.

  2. 注册 InfinityFree/Register for InfinityFree
    打开 InfinityFree 官方注册页面,用 Email、Google 或 GitHub 注册免费账号。/Open the official InfinityFree signup page and register with Email, Google, or GitHub.

  3. 创建免费网址/Create a free website address
    创建一个免费的 InfinityFree 子域名,不购买域名,先让网站直接上线。/Create a free InfinityFree subdomain and skip buying a domain so the website can go online immediately.

  4. 创建 PHP 网站/Create the PHP website
    建立一个简单的 index.php,让页面显示网站名称、当前时间和服务器状态。/Create a simple index.php that displays the site name, current time, and server status.

  5. 创建 MySQL 数据库/Create the MySQL database
    在 InfinityFree 控制面板创建一个 MySQL 数据库,用来保存简单的网站状态记录。/Create a MySQL database in the InfinityFree control panel to store simple website status records.

  6. 上传网站文件/Upload the website files
    使用 InfinityFree 在线文件管理器或 FTP 上传 PHP、CSS 和图片文件。/Use InfinityFree File Manager or FTP to upload the PHP, CSS, and image files.

  7. 开启免费 HTTPS/Enable free HTTPS
    使用 InfinityFree 提供的免费 SSL,让网站通过 HTTPS 打开,不花钱也不让浏览器天天皱眉。/Enable the free SSL certificate so the site works over HTTPS without making the browser complain.

  8. 测试公网网站/Test the public website
    用 Safari 的隐私浏览窗口打开免费子域名,确认 PHP 页面和 MySQL 功能正常。/Open the free subdomain in a private Safari window and confirm that PHP and MySQL work correctly.

  9. 注册 AWS Free Plan/Create the AWS Free Plan account
    进入 AWS Free Tier,创建新账户并选择 Free Plan;新用户通常获得 $100 credits,最多可通过活动获得 $200。/Open AWS Free Tier, create a new account, and choose the Free Plan; new users normally receive $100 in credits and can earn up to $200 through activities.

  10. 不购买任何付费服务/Do not activate paid features
    整个实验只使用 Free Plan 和 credits,不主动升级 Paid Plan,也不启用不需要的高级功能。/Use only the Free Plan and credits, without upgrading to the Paid Plan or activating unnecessary advanced features.

  11. 设置 MFA/Enable MFA
    给 AWS 根账户开启多因素认证,这是免费云服务器最便宜也最重要的安全措施。/Enable multi-factor authentication on the AWS root account because it is the cheapest and most important cloud security step.

  12. 设置预算提醒/Set budget alerts
    在 AWS Billing 中设置预算和使用量提醒,防止以后误升级或资源失控。/Set budget and usage alerts in AWS Billing so future changes cannot quietly turn into a bill.

  13. 领取额外 AWS credits/Earn additional AWS credits
    打开 AWS Console 的 Explore AWS 活动,根据账户实际显示的任务完成可获得的额外 credits 操作。/Open Explore AWS in the AWS Console and complete the activities actually offered to your account to earn additional credits.

  14. 创建 Lightsail VPS/Create the Lightsail VPS
    进入 Lightsail,选择 Linux/Unix 和 Ubuntu,创建最低成本的 Lightsail 实例并让 AWS credits 覆盖实验费用。/Open Lightsail, choose Linux/Unix and Ubuntu, create the smallest suitable instance, and use AWS credits to cover the experiment.

  15. 选择澳洲附近区域/Choose a nearby region
    如果账户和具体套餐允许,优先选择距离澳洲较近的 AWS Region,以降低 SSH 和网站检测延迟。/If the account and selected bundle allow it, choose an AWS Region close to Australia to reduce SSH and monitoring latency.

  16. 使用浏览器 SSH/Use browser SSH
    先使用 Lightsail 自带的浏览器 SSH 登录 Ubuntu,确认 VPS 真正拥有独立 Linux 环境。/First use Lightsail’s built-in browser SSH to enter Ubuntu and confirm that you have a real independent Linux environment.

  17. 从 Mac SSH 登录/SSH from the Mac
    在 macOS Terminal 使用 AWS 提供的连接信息从本机 SSH 登录 VPS。/Use the connection details provided by AWS to SSH into the VPS from macOS Terminal.

  18. 安装基础工具/Install basic tools
    在 Ubuntu 中安装 Python 3、curl、Git 和必要的系统工具,让这台小 VPS 变成真正可用的实验机。/Install Python 3, curl, Git, and essential system tools so the VPS becomes a practical little lab.

  19. 编写网站检测程序/Create the website checker
    写一个简单 Python 程序访问 InfinityFree 网站并记录 HTTP 状态码和响应时间。/Write a small Python program that checks the InfinityFree website and records its HTTP status code and response time.

  20. 手动运行检测/Run the checker manually
    先运行一次 Python 检测程序,确认 VPS 可以访问公网网站并得到正常 HTTP 响应。/Run the Python checker once to confirm that the VPS can reach the public website and receive a valid HTTP response.

  21. 创建状态接口/Create a status endpoint
    在 InfinityFree 网站增加一个简单 PHP 接口,让 VPS 可以提交最近一次检测结果。/Add a simple PHP endpoint to the InfinityFree site so the VPS can submit its latest monitoring result.

  22. 增加安全校验/Add basic security
    接口只接受必要的数据并使用随机密钥验证请求,避免任何陌生人随便修改网站状态。/Accept only the required data and use a random secret to authenticate requests so strangers cannot rewrite the status.

  23. 让 PHP 显示 VPS 状态/Display the VPS status in PHP
    网站首页读取最新检测结果,并显示网站状态、最后检测时间和响应时间。/Make the homepage display the latest check result, last check time, and response time.

  24. 设置 Linux 定时任务/Create a Linux scheduled task
    在 Ubuntu VPS 中使用 cron 每隔几分钟执行检测程序,让网站状态自动更新。/Use cron on the Ubuntu VPS to run the checker every few minutes and update the website automatically.

  25. 完成最终测试/Run the final test
    关闭本地 Mac 上的 Terminal 也没有关系,因为检测程序已经运行在云端 VPS 上。/Closing Terminal on the Mac does not matter because the monitoring program is now running on the cloud VPS.

  26. 查看最终效果/Check the final result
    普通用户只需要打开免费 InfinityFree 地址,就能看到一个真正运行在公网的网站和来自 AWS VPS 的实时状态。/A normal visitor only needs the free InfinityFree address to see a real public website with status information supplied by the AWS VPS.

  27. 同时理解两种主机/Understand the two hosting models
    InfinityFree负责简单公网 PHP 网站,Lightsail负责需要 SSH、Python 和后台任务的真正 VPS 工作。/InfinityFree handles the simple public PHP website, while Lightsail handles real VPS work that needs SSH, Python, and background tasks.

  28. 不再碰所谓32GB免费VPS/Skip the so-called free 32GB VPS
    不把未经充分验证的32GB八核免费 VPS 放进核心方案,宁愿使用官方 AWS credits 换取可靠的真实 VPS。/Do not make an insufficiently verified 32GB eight-core free VPS part of the core setup; use official AWS credits for a real VPS instead.

  29. 实验结束前删除资源/Delete resources when finished
    如果不再需要 Lightsail,立即删除实例和其他不需要的资源,并在 AWS Free Plan 到期前再次检查账户。/If you no longer need Lightsail, delete the instance and unnecessary resources immediately and review the account again before the AWS Free Plan expires.

  30. 记住真正的免费逻辑/Remember the real meaning of free
    InfinityFree是长期免费的 PHP 主机,AWS 是有限期 credits,两个免费不是一回事。/InfinityFree is long-term free PHP hosting, while AWS is time-limited credits; the two kinds of free are not the same.

设置root 密码登录: echo 'root:你的实际密码' | chpasswd && printf '%s\n' 'PermitRootLogin yes' 'PasswordAuthentication yes' 'KbdInteractiveAuthentication yes' > /etc/ssh/sshd_config.d/99-root-password.conf && sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config.d/60-cloudimg-settings.conf && sshd -t && systemctl restart ssh 修改 SSH 配置文件: sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config.d/60-cloudimg-settings.conf 测试配置并重启 SSH 服务: sshd -t && systemctl restart ssh 检查当前生效的 SSH 配置: sshd -T | grep -Ei 'permitrootlogin|passwordauthentication|kbdinteractiveauthentication' ssh 连接: ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no root@{你实际的公网IP}

相关链接 (Related Links):
https://hyperphp.com/
https://www.infinityfree.com
https://dash.infinityfree.com/register
https://www.infinityfree.com/terms/
https://aws.amazon.com/free/
https://signin.aws.amazon.com/signup?request_type=builderId
https://namefake.com/
https://jiemahao.com/
https://aws.amazon.com/lightsail/
https://aws.amazon.com/lightsail/pricing/
https://aws.amazon.com/resources/create-account/
https://docs.aws.amazon.com/lightsail/
https://docs.aws.amazon.com/lightsail/latest/userguide/getting-started-with-amazon-lightsail.html
https://docs.aws.amazon.com/lightsail/latest/userguide/how-to-create-amazon-lightsail-instance-virtual-private-server-vps.html
https://github.com/aws/aws-cli
https://github.com/aws-samples
https://github.com/eooce/ssh_tool


评论

爽文共赏/Popular Posts

5分钟拿下原生IP + 免费节点 手残变大佬 | From Noob to Pro in 5 Minutes: 10 Real IPs + Daily Fresh Free Nodes

一口气搭好!Cloudflare融合Railway与Galaxy打造纯净原生免费VPS | Build a Pure Free VPS with Cloudflare + Railway + Galaxy in One Go

免费节点无限续?OneBox+subs-check,付费党沉默了 | Free Nodes Never Die? OneBox + subs-check, Paid Users Left Speechless

3 Steps to AI Video Fame✨WebSocket+Copilot Auto-Update, Newbies Win Too | 3 步 AI 视频封神✨WebSocket+Copilot 自动更,小白也能卷赢

Game-Changing! Get AI Parenting+Math Enlightenment for Free | 0成本get AI育儿+数学启蒙双buff,躺赢养娃

零成本薅云服务器 | 三分钟开人生外挂 ⚡ | Zero-Cost Cloud Hustle | Life Cheat Code for Broke Devs 🍜