🚀 从0到1:我的网站开发心路历程与小白路线图
给所有想从零开始做网站的小白参考
📚 目录
- 项目概览
- 心路历程
- 技术栈选择
- 开发阶段
- 部署阶段
- 踩坑与成长
- 小白路线图
📋 项目概览
我的网站是什么?
这是一个个人AI工具集合网站,包含:
- 前端展示:个人主页、关于我、文章、联系方式
- 5个AI工具Demo:
- E-Tester:英语测试系统(完整题库、评分、进度跟踪)
- PMentor:项目管理能力评估(问卷、AI分析、IDP报告)
- Forge:目标制定工具(目标生成、评估、KPI管理)
- A3Gen:问题分析工具(5WHY分析、根因挖掘)
- PM-Learning:项目管理学习系统
技术架构
┌─────────────────────────────────────────┐
│ 用户访问层 (Nginx) │
│ https://charleswang.com.cn │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ 前端服务 (Astro + React) │
│ 端口: 3000 │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ 后端API服务集群 (FastAPI) │
│ ┌──────────┬──────────┬──────────┐ │
│ │ E-Tester │ PMentor │ Forge │ │
│ │ :5004 │ :5003 │ :5001 │ │
│ └──────────┴──────────┴──────────┘ │
│ ┌──────────┬──────────┐ │
│ │ A3Gen │PM-Learning│ │
│ │ :5002 │ :5005 │ │
│ └──────────┴──────────┘ │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ 数据层 (SQLite + 文件存储) │
└─────────────────────────────────────────┘
💭 心路历程
阶段一:从想法到开始(第1周)
心态:兴奋 + 迷茫
我在想什么?
- "我想做一个个人网站,展示我的作品"
- "我想把那些AI工具整合在一起"
- "但我完全不知道从哪里开始..."
我做了什么?
- 搜索"如何做一个网站"
- 看了无数教程,但都太复杂
- 决定从最简单的开始:先做一个静态页面
关键决定:
- ✅ 选择Astro作为前端框架(简单、快速)
- ✅ 决定先做前端,后端后面再加
- ✅ 不追求完美,先做出能用的版本
阶段二:第一个页面(第2-3周)
心态:成就感 + 挫败感交替
我在想什么?
- "哇,我的第一个页面出来了!"
- "为什么样式这么丑?"
- "这个按钮怎么点不了?"
我做了什么?
- 跟着Astro官方教程做了第一个页面
- 学习Tailwind CSS美化界面
- 添加导航栏、页脚等基础组件
遇到的困难:
- CSS样式不知道怎么调
- 响应式设计完全不懂
- 每次改代码都要刷新浏览器看效果
解决方案:
- 使用Tailwind CSS的预设样式
- 参考其他网站的设计
- 使用浏览器开发者工具调试
阶段三:添加第一个功能(第4-5周)
心态:紧张 + 期待
我在想什么?
- "我想做一个英语测试工具"
- "需要后端吗?"
- "数据库怎么用?"
我做了什么?
- 学习FastAPI(Python后端框架)
- 设计第一个API接口
- 连接SQLite数据库
- 前后端联调
遇到的困难:
- 不知道前后端怎么通信
- CORS跨域问题
- 数据库操作不熟悉
解决方案:
- 使用fetch API发送请求
- 配置CORS允许跨域
- 使用SQLAlchemy简化数据库操作
阶段四:功能扩展(第6-10周)
心态:越来越自信
我在想什么?
- "第一个功能做出来了,我可以做更多!"
- "要不要加AI功能?"
- "怎么让界面更好看?"
我做了什么?
- 添加了5个不同的AI工具
- 集成DeepSeek API(AI能力)
- 优化用户体验
- 添加数据可视化(雷达图、图表)
学到的技能:
- 前后端分离架构
- RESTful API设计
- 异步编程(async/await)
- 数据可视化(Chart.js)
阶段五:部署上线(第11-12周)
心态:焦虑 + 兴奋
我在想什么?
- "本地能跑,服务器能跑吗?"
- "怎么买服务器?"
- "域名怎么配置?"
我做了什么?
- 购买阿里云ECS服务器
- 配置Linux环境
- 部署代码到服务器
- 配置Nginx反向代理
- 申请SSL证书(HTTPS)
遇到的困难(这是最痛苦的阶段):
- Windows本地开发,Linux服务器部署,环境不一致
- 代码在本地能跑,服务器报错
- 不知道问题在哪里,只能一点点排查
解决方案:
- 详细记录每个错误和解决方法
- 创建部署脚本自动化流程
- 学习Linux基础命令
- 使用Git版本控制
阶段六:优化与维护(第13周至今)
心态:成熟 + 持续学习
我在想什么?
- "网站能用了,但还有很多可以改进"
- "用户反馈很重要"
- "要持续更新和维护"
我做了什么?
- 优化SEO(搜索引擎优化)
- 添加监控和日志
- 修复bug和改进功能
- 写文档记录经验
🛠️ 技术栈选择
为什么选择这些技术?
前端:Astro + React + Tailwind CSS
Astro:
- ✅ 简单易学,适合新手
- ✅ 性能好(静态站点生成)
- ✅ 支持多种框架(React、Vue等)
- ✅ 官方文档清晰
React:
- ✅ 组件化开发,代码复用
- ✅ 生态丰富,有很多现成组件
- ✅ 学习资源多
Tailwind CSS:
- ✅ 不需要写CSS,用类名就行
- ✅ 响应式设计简单
- ✅ 样式统一美观
后端:Python + FastAPI
Python:
- ✅ 语法简单,容易上手
- ✅ 库丰富,AI相关库多
- ✅ 适合快速开发
FastAPI:
- ✅ 现代、快速
- ✅ 自动生成API文档
- ✅ 类型提示支持好
- ✅ 异步支持
数据库:SQLite
为什么选SQLite?
- ✅ 不需要单独安装数据库服务器
- ✅ 文件数据库,简单易用
- ✅ 适合小型项目
- ✅ 迁移方便
部署:Nginx + Linux
Nginx:
- ✅ 性能好,稳定
- ✅ 配置相对简单
- ✅ 支持反向代理和负载均衡
Linux服务器:
- ✅ 成本低(阿里云ECS)
- ✅ 稳定可靠
- ✅ 学习Linux很有用
📖 开发阶段详解
第1阶段:环境搭建(1-2天)
目标:让代码能在本地运行
步骤:
安装Node.js
# 下载安装Node.js (https://nodejs.org/)
# 验证安装
node --version
npm --version
安装Python
# 下载安装Python 3.10+ (https://www.python.org/)
# 验证安装
python --version
创建前端项目
npm create astro@latest charles-genai-site
cd charles-genai-site
npm install
npm run dev
创建后端项目
mkdir english_test_backend
cd english_test_backend
python -m venv venv
venv\Scripts\activate # Windows
pip install fastapi uvicorn
检查清单:
第2阶段:第一个页面(3-5天)
目标:做出一个能看的页面
步骤:
修改主页
```astro
// src/pages/index.astro
// 页面逻辑
我的网站
欢迎来到我的网站
```
添加导航栏
美化样式
- 使用Tailwind CSS
- 调整颜色、字体、间距
检查清单:
第3阶段:第一个API(5-7天)
目标:前后端能通信
步骤:
创建后端API
# english_test_backend/app.py
from fastapi import FastAPI
app = FastAPI()
@app.get("/api/health")
def health():
return {"status": "ok"}
前端调用API
// 在Astro组件中
const response = await fetch('http://localhost:5004/api/health');
const data = await response.json();
配置代理(解决跨域)
// astro.config.mjs
export default defineConfig({
vite: {
server: {
proxy: {
'/api/english-test': {
target: 'http://localhost:5004',
changeOrigin: true,
}
}
}
}
});
检查清单:
第4阶段:数据库操作(7-10天)
目标:能存储和读取数据
步骤:
设计数据库表
# 用户表、题目表、答案表等
使用SQLAlchemy
from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
name = Column(String)
CRUD操作
- Create(创建)
- Read(读取)
- Update(更新)
- Delete(删除)
检查清单:
第5阶段:完整功能(10-15天)
目标:做出一个完整可用的工具
步骤:
设计功能流程
实现每个步骤
测试和调试
检查清单:
🚀 部署阶段详解
部署前的准备
需要准备的东西:
- 服务器:阿里云ECS(2核2GB,年费99元,平均每月约8.25元)
- 域名:charleswang.com.cn(约50元/年)
- SSL证书:阿里云免费证书
部署步骤
1. 连接服务器(10分钟)
# SSH连接
ssh root@101.37.180.66
# 更新系统
sudo yum update -y
# 安装基础工具
sudo yum install -y git wget curl
2. 安装环境(30分钟)
# 安装Node.js
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
sudo yum install -y nodejs
# 安装Python
sudo yum install -y python3 python3-pip
# 安装Nginx
sudo yum install -y nginx
3. 上传代码(20分钟)
# 方法1:使用Git
git clone <your-repo-url> /var/www/mywebsite
# 方法2:使用WinSCP上传文件
4. 配置服务(40分钟)
配置后端服务:
# 创建systemd服务
sudo nano /etc/systemd/system/english-test.service
[Unit]
Description=English Test API
After=network.target
[Service]
WorkingDirectory=/var/www/mywebsite/english_test_backend
ExecStart=/usr/bin/python3 -m uvicorn app:app --host 0.0.0.0 --port 5004
Restart=always
[Install]
WantedBy=multi-user.target
# 启动服务
sudo systemctl enable english-test
sudo systemctl start english-test
配置Nginx:
server {
listen 80;
server_name charleswang.com.cn;
location / {
proxy_pass http://localhost:3000;
}
location /api/english-test/ {
proxy_pass http://localhost:5004/;
}
}
5. 配置SSL(30分钟)
# 使用certbot申请证书
sudo yum install -y certbot python3-certbot-nginx
sudo certbot --nginx -d charleswang.com.cn
6. 构建前端(20分钟)
cd /var/www/mywebsite/charles-genai-site
npm install
npm run build
# 配置Nginx指向dist目录
部署后的检查
检查清单:
💥 踩坑与成长
最大的坑:跨平台兼容性
问题:Windows本地开发,Linux服务器部署
遇到的错误:
换行符问题:Windows用CRLF,Linux用LF
- 错误:
syntax error: unexpected token
- 解决:使用
dos2unix转换
JavaScript版本问题:服务器V8版本较旧
- 错误:
Unexpected token 'const'
- 解决:ES6语法转ES5
Python版本问题:本地Python 3.9+,服务器Python 3.6
- 错误:
'type' object is not subscriptable
- 解决:使用
List[str]而不是list[str]
经验教训:
- ✅ 开发时就要考虑部署环境
- ✅ 使用Docker可以避免环境差异
- ✅ 详细记录每个错误和解决方法
第二大坑:前后端通信
问题:不知道前后端怎么连接
遇到的错误:
CORS跨域错误
- 错误:
Access-Control-Allow-Origin
- 解决:配置CORS或使用代理
API路径错误
- 错误:404 Not Found
- 解决:检查Nginx配置和API路径
数据格式不匹配
- 错误:前端收到数据但解析失败
- 解决:统一使用JSON格式
经验教训:
- ✅ 使用API代理简化路径
- ✅ 统一数据格式(JSON)
- ✅ 使用TypeScript可以避免类型错误
第三大坑:数据库操作
问题:不知道如何设计和使用数据库
遇到的错误:
数据库锁定
- 错误:
database is locked
- 解决:使用连接池,及时关闭连接
数据丢失
查询性能问题
经验教训:
- ✅ 使用ORM(SQLAlchemy)简化操作
- ✅ 设计好数据库结构
- ✅ 定期备份数据
最重要的经验
不要害怕错误
从小功能开始
持续学习
写文档
🗺️ 小白路线图
如果你是完全小白,按这个顺序学习:
第1周:基础知识
目标:了解Web开发基础
学习内容:
HTML基础
CSS基础
JavaScript基础
推荐资源:
第2-3周:前端框架
目标:学会使用现代前端框架
学习内容:
React基础
- 组件、Props、State
- 练习:做一个Todo List
Astro基础
Tailwind CSS
推荐资源:
第4-5周:后端开发
目标:学会创建API
学习内容:
Python基础
FastAPI基础
数据库基础
- SQL基础、SQLite使用
- 练习:存储和查询数据
推荐资源:
第6-8周:完整项目
目标:做一个完整的项目
项目建议:
个人博客
- 前端:Astro + Tailwind
- 后端:FastAPI
- 功能:文章列表、详情、搜索
待办事项应用
- 前端:React
- 后端:FastAPI
- 功能:增删改查、分类
简单聊天室
- 前端:React
- 后端:FastAPI + WebSocket
- 功能:实时聊天
第9-10周:部署上线
目标:让网站能在互联网上访问
学习内容:
Linux基础
服务器配置
域名和SSL
推荐资源:
持续学习
建议:
- 每周至少写代码2-3次
- 参与开源项目
- 阅读技术博客
- 参加技术社区
🎯 给小白的话
不要害怕
- 每个人都是从零开始的
- 错误是学习的一部分
- 不要追求完美,先做出能用的
学习方法
动手实践
- 只看教程不够,要自己写代码
- 遇到问题先自己尝试解决
记录过程
寻求帮助
持续学习
推荐学习路径
HTML/CSS/JS基础 (2周)
↓
选择一个前端框架 (2-3周)
↓
学习后端开发 (2-3周)
↓
做一个完整项目 (3-4周)
↓
部署上线 (1-2周)
↓
持续改进和学习
常见问题
Q: 我没有编程基础,能学会吗?
A: 能!只要坚持学习,每天进步一点点,1-2个月就能做出自己的网站。
Q: 需要买服务器吗?
A: 初期可以在本地开发,等做出能用的版本再考虑部署。服务器不贵,阿里云ECS年费99元,平均每月约8.25元。
Q: 遇到问题怎么办?
A:
- 先看错误信息,理解问题
- 搜索错误信息,看别人怎么解决的
- 如果还不行,在技术社区提问
Q: 要学多久才能做出网站?
A: 如果每天学习2-3小时,1-2个月就能做出一个完整的网站。
Q: 需要学哪些技术?
A:
- 前端:HTML、CSS、JavaScript、React(或Vue)
- 后端:Python(或Node.js)、FastAPI(或Express)
- 数据库:SQLite(简单)或MySQL(复杂)
- 部署:Linux基础、Nginx配置
🌟 最后的话
从0到1做网站,最难的不是技术,而是开始。
不要等到"准备好了"再开始,现在就动手:
- 打开电脑
- 安装Node.js和Python
- 跟着教程做第一个页面
- 遇到问题就解决问题
- 持续改进
记住:
- ✅ 每个专家都曾经是新手
- ✅ 每个错误都是学习机会
- ✅ 持续学习比天赋更重要
- ✅ 动手实践比只看教程更有效
祝你成功! 🚀
本文档基于真实项目经验整理,希望能帮助到想从零开始做网站的朋友们。
最后更新:2025年11月
🚀 From Zero to One: My Website Development Journey and Beginner's Roadmap
A reference guide for all beginners who want to build a website from scratch
📚 Table of Contents
- Project Overview
- My Journey
- Technology Stack Choices
- Development Phases
- Deployment Phase
- Challenges and Growth
- Beginner's Roadmap
📋 Project Overview
What is My Website?
This is a personal AI tools collection website that includes:
- Frontend Display: Personal homepage, About me, Articles, Contact
- 5 AI Tool Demos:
- E-Tester: English test system (complete question bank, scoring, progress tracking)
- PMentor: Project management competency assessment (questionnaire, AI analysis, IDP reports)
- Forge: Goal-setting tool (goal generation, evaluation, KPI management)
- A3Gen: Problem analysis tool (5WHY analysis, root cause mining)
- PM-Learning: Project management learning system
Technical Architecture
┌─────────────────────────────────────────┐
│ User Access Layer (Nginx) │
│ https://charleswang.com.cn │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ Frontend Service (Astro + React) │
│ Port: 3000 │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ Backend API Service Cluster │
│ (FastAPI) │
│ ┌──────────┬──────────┬──────────┐ │
│ │ E-Tester │ PMentor │ Forge │ │
│ │ :5004 │ :5003 │ :5001 │ │
│ └──────────┴──────────┴──────────┘ │
│ ┌──────────┬──────────┐ │
│ │ A3Gen │PM-Learning│ │
│ │ :5002 │ :5005 │ │
│ └──────────┴──────────┘ │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ Data Layer (SQLite + File Storage) │
└─────────────────────────────────────────┘
💭 My Journey
Phase 1: From Idea to Start (Week 1)
Mindset: Excitement + Confusion
What was I thinking?
- "I want to build a personal website to showcase my work"
- "I want to integrate those AI tools together"
- "But I have no idea where to start..."
What did I do?
- Searched "how to build a website"
- Watched countless tutorials, but they were all too complex
- Decided to start with the simplest: make a static page first
Key Decisions:
- ✅ Choose Astro as frontend framework (simple, fast)
- ✅ Decide to build frontend first, add backend later
- ✅ Don't pursue perfection, make a working version first
Phase 2: First Page (Weeks 2-3)
Mindset: Sense of achievement + frustration alternating
What was I thinking?
- "Wow, my first page is live!"
- "Why does it look so ugly?"
- "Why isn't this button working?"
What did I do?
- Followed Astro official tutorial to create the first page
- Learned Tailwind CSS to beautify the interface
- Added navigation bar, footer, and other basic components
Challenges I faced:
- Didn't know how to adjust CSS styles
- Completely unfamiliar with responsive design
- Had to refresh browser every time I changed code to see the effect
Solutions:
- Used Tailwind CSS preset styles
- Referenced designs from other websites
- Used browser developer tools for debugging
Phase 3: Adding First Feature (Weeks 4-5)
Mindset: Nervous + Excited
What was I thinking?
- "I want to build an English test tool"
- "Do I need a backend?"
- "How do I use a database?"
What did I do?
- Learned FastAPI (Python backend framework)
- Designed the first API endpoint
- Connected to SQLite database
- Integrated frontend and backend
Challenges I faced:
- Didn't know how frontend and backend communicate
- CORS cross-origin issues
- Unfamiliar with database operations
Solutions:
- Used fetch API to send requests
- Configured CORS to allow cross-origin
- Used SQLAlchemy to simplify database operations
Phase 4: Feature Expansion (Weeks 6-10)
Mindset: Growing confidence
What was I thinking?
- "I made the first feature work, I can do more!"
- "Should I add AI features?"
- "How can I make the interface look better?"
What did I do?
- Added 5 different AI tools
- Integrated DeepSeek API (AI capabilities)
- Optimized user experience
- Added data visualization (radar charts, graphs)
Skills I learned:
- Frontend-backend separation architecture
- RESTful API design
- Async programming (async/await)
- Data visualization (Chart.js)
Phase 5: Deployment (Weeks 11-12)
Mindset: Anxious + Excited
What was I thinking?
- "It works locally, will it work on the server?"
- "How do I buy a server?"
- "How do I configure a domain?"
What did I do?
- Purchased Alibaba Cloud ECS server
- Configured Linux environment
- Deployed code to server
- Configured Nginx reverse proxy
- Applied for SSL certificate (HTTPS)
Challenges I faced (This was the most painful phase):
- Windows local development, Linux server deployment, environment inconsistency
- Code worked locally but failed on server
- Didn't know where the problem was, had to troubleshoot step by step
Solutions:
- Detailed documentation of every error and solution
- Created deployment scripts to automate the process
- Learned basic Linux commands
- Used Git for version control
Phase 6: Optimization and Maintenance (Week 13 - Present)
Mindset: Mature + Continuous learning
What was I thinking?
- "The website works, but there's still a lot to improve"
- "User feedback is important"
- "Need to continuously update and maintain"
What did I do?
- Optimized SEO (search engine optimization)
- Added monitoring and logging
- Fixed bugs and improved features
- Wrote documentation to record experiences
🛠️ Technology Stack Choices
Why These Technologies?
Frontend: Astro + React + Tailwind CSS
Astro:
- ✅ Simple and easy to learn, suitable for beginners
- ✅ Great performance (static site generation)
- ✅ Supports multiple frameworks (React, Vue, etc.)
- ✅ Clear official documentation
React:
- ✅ Component-based development, code reusability
- ✅ Rich ecosystem with many ready-made components
- ✅ Abundant learning resources
Tailwind CSS:
- ✅ No need to write CSS, just use class names
- ✅ Simple responsive design
- ✅ Unified and beautiful styling
Backend: Python + FastAPI
Python:
- ✅ Simple syntax, easy to learn
- ✅ Rich libraries, especially for AI
- ✅ Suitable for rapid development
FastAPI:
- ✅ Modern and fast
- ✅ Auto-generates API documentation
- ✅ Great type hint support
- ✅ Async support
Database: SQLite
Why SQLite?
- ✅ No need to install a separate database server
- ✅ File-based database, simple and easy to use
- ✅ Suitable for small projects
- ✅ Easy to migrate
Deployment: Nginx + Linux
Nginx:
- ✅ Great performance, stable
- ✅ Relatively simple configuration
- ✅ Supports reverse proxy and load balancing
Linux Server:
- ✅ Low cost (Alibaba Cloud ECS)
- ✅ Stable and reliable
- ✅ Learning Linux is very useful
📖 Development Phases Explained
Phase 1: Environment Setup (1-2 days)
Goal: Make code run locally
Steps:
Install Node.js
# Download and install Node.js (https://nodejs.org/)
# Verify installation
node --version
npm --version
Install Python
# Download and install Python 3.10+ (https://www.python.org/)
# Verify installation
python --version
Create Frontend Project
npm create astro@latest charles-genai-site
cd charles-genai-site
npm install
npm run dev
Create Backend Project
mkdir english_test_backend
cd english_test_backend
python -m venv venv
venv\Scripts\activate # Windows
pip install fastapi uvicorn
Checklist:
Phase 2: First Page (3-5 days)
Goal: Create a presentable page
Steps:
Modify Homepage
```astro
// src/pages/index.astro
// Page logic
My Website
Welcome to My Website
```
Add Navigation Bar
- Create navigation component
- Add links
Beautify Styling
- Use Tailwind CSS
- Adjust colors, fonts, spacing
Checklist:
Phase 3: First API (5-7 days)
Goal: Frontend and backend can communicate
Steps:
Create Backend API
# english_test_backend/app.py
from fastapi import FastAPI
app = FastAPI()
@app.get("/api/health")
def health():
return {"status": "ok"}
Frontend Calls API
// In Astro component
const response = await fetch('http://localhost:5004/api/health');
const data = await response.json();
Configure Proxy (Solve CORS)
// astro.config.mjs
export default defineConfig({
vite: {
server: {
proxy: {
'/api/english-test': {
target: 'http://localhost:5004',
changeOrigin: true,
}
}
}
}
});
Checklist:
Phase 4: Database Operations (7-10 days)
Goal: Can store and read data
Steps:
Design Database Tables
# User table, question table, answer table, etc.
Use SQLAlchemy
from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
name = Column(String)
CRUD Operations
- Create
- Read
- Update
- Delete
Checklist:
Phase 5: Complete Feature (10-15 days)
Goal: Build a complete, usable tool
Steps:
Design Feature Flow
- User enters page
- Select questions
- Answer questions
- Submit answers
- View results
Implement Each Step
- Frontend interface
- Backend logic
- Database operations
Test and Debug
- Test various scenarios
- Fix bugs
- Optimize experience
Checklist:
🚀 Deployment Phase Explained
Pre-Deployment Preparation
What you need:
- Server: Alibaba Cloud ECS (2 cores, 2GB RAM, ¥99/year, ~¥8.25/month or ~$1.15/month)
- Domain: charleswang.com.cn (~$7/year)
- SSL Certificate: Alibaba Cloud free certificate
Deployment Steps
1. Connect to Server (10 minutes)
# SSH connection
ssh root@101.37.180.66
# Update system
sudo yum update -y
# Install basic tools
sudo yum install -y git wget curl
2. Install Environment (30 minutes)
# Install Node.js
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
sudo yum install -y nodejs
# Install Python
sudo yum install -y python3 python3-pip
# Install Nginx
sudo yum install -y nginx
3. Upload Code (20 minutes)
# Method 1: Use Git
git clone <your-repo-url> /var/www/mywebsite
# Method 2: Use WinSCP to upload files
Configure Backend Service:
# Create systemd service
sudo nano /etc/systemd/system/english-test.service
[Unit]
Description=English Test API
After=network.target
[Service]
WorkingDirectory=/var/www/mywebsite/english_test_backend
ExecStart=/usr/bin/python3 -m uvicorn app:app --host 0.0.0.0 --port 5004
Restart=always
[Install]
WantedBy=multi-user.target
# Start service
sudo systemctl enable english-test
sudo systemctl start english-test
Configure Nginx:
server {
listen 80;
server_name charleswang.com.cn;
location / {
proxy_pass http://localhost:3000;
}
location /api/english-test/ {
proxy_pass http://localhost:5004/;
}
}
# Use certbot to apply for certificate
sudo yum install -y certbot python3-certbot-nginx
sudo certbot --nginx -d charleswang.com.cn
6. Build Frontend (20 minutes)
cd /var/www/mywebsite/charles-genai-site
npm install
npm run build
# Configure Nginx to point to dist directory
Post-Deployment Checks
Checklist:
💥 Challenges and Growth
Problem: Windows local development, Linux server deployment
Errors Encountered:
Line Ending Issues: Windows uses CRLF, Linux uses LF
- Error:
syntax error: unexpected token
- Solution: Use
dos2unix to convert
JavaScript Version Issues: Server V8 version is older
- Error:
Unexpected token 'const'
- Solution: Convert ES6 syntax to ES5
Python Version Issues: Local Python 3.9+, server Python 3.6
- Error:
'type' object is not subscriptable
- Solution: Use
List[str] instead of list[str]
Lessons Learned:
- ✅ Consider deployment environment during development
- ✅ Using Docker can avoid environment differences
- ✅ Document every error and solution in detail
Second Biggest Challenge: Frontend-Backend Communication
Problem: Didn't know how to connect frontend and backend
Errors Encountered:
CORS Cross-Origin Error
- Error:
Access-Control-Allow-Origin
- Solution: Configure CORS or use proxy
API Path Errors
- Error: 404 Not Found
- Solution: Check Nginx configuration and API paths
Data Format Mismatch
- Error: Frontend receives data but parsing fails
- Solution: Use JSON format consistently
Lessons Learned:
- ✅ Use API proxy to simplify paths
- ✅ Use consistent data format (JSON)
- ✅ Using TypeScript can avoid type errors
Third Biggest Challenge: Database Operations
Problem: Didn't know how to design and use databases
Errors Encountered:
Database Locking
- Error:
database is locked
- Solution: Use connection pool, close connections promptly
Data Loss
- Error: Data not saved
- Solution: Ensure transaction commit
Query Performance Issues
- Error: Queries are slow
- Solution: Add indexes, optimize queries
Lessons Learned:
- ✅ Use ORM (SQLAlchemy) to simplify operations
- ✅ Design database structure well
- ✅ Regular data backups
Most Important Lessons
Don't Be Afraid of Errors
- Every error is a learning opportunity
- Document errors and solutions
Start with Small Features
- Don't try to build a complete system from the start
- Make a working minimum viable version first
Keep Learning
- Technology updates quickly
- Maintain the habit of learning new technologies
Write Documentation
- Document the development process
- Convenient for future review and sharing
🗺️ Beginner's Roadmap
If you're a complete beginner, learn in this order:
Week 1: Fundamentals
Goal: Understand web development basics
Learning Content:
HTML Basics
- Tags, attributes, structure
- Practice: Make a simple personal introduction page
CSS Basics
- Selectors, styles, layout
- Practice: Beautify the personal introduction page
JavaScript Basics
- Variables, functions, events
- Practice: Add interactive features (button clicks)
Recommended Resources:
Weeks 2-3: Frontend Framework
Goal: Learn to use modern frontend frameworks
Learning Content:
React Basics
- Components, Props, State
- Practice: Build a Todo List
Astro Basics
- Pages, components, layouts
- Practice: Build a blog website
Tailwind CSS
- Utility classes, responsive design
- Practice: Beautify the blog website
Recommended Resources:
Weeks 4-5: Backend Development
Goal: Learn to create APIs
Learning Content:
Python Basics
- Syntax, data types, functions
- Practice: Write some small programs
FastAPI Basics
- Routes, requests, responses
- Practice: Build a simple API
Database Basics
- SQL basics, SQLite usage
- Practice: Store and query data
Recommended Resources:
Weeks 6-8: Complete Project
Goal: Build a complete project
Project Suggestions:
Personal Blog
- Frontend: Astro + Tailwind
- Backend: FastAPI
- Features: Article list, details, search
Todo Application
- Frontend: React
- Backend: FastAPI
- Features: CRUD operations, categories
Simple Chat Room
- Frontend: React
- Backend: FastAPI + WebSocket
- Features: Real-time chat
Weeks 9-10: Deployment
Goal: Make website accessible on the internet
Learning Content:
Linux Basics
- Basic commands, file operations
- Practice: Operate on a server
Server Configuration
- Nginx configuration, service management
- Practice: Deploy a simple website
Domain and SSL
- Domain resolution, certificate application
- Practice: Configure HTTPS
Recommended Resources:
Continuous Learning
Suggestions:
- Write code at least 2-3 times per week
- Contribute to open source projects
- Read technical blogs
- Join technical communities
🎯 Words for Beginners
Don't Be Afraid
- Everyone starts from zero
- Errors are part of learning
- Don't pursue perfection, make something that works first
Learning Methods
Hands-on Practice
- Just watching tutorials isn't enough, you need to write code yourself
- Try to solve problems yourself first when you encounter them
Document the Process
- Write a blog to document your learning process
- Record problems you encounter and their solutions
Seek Help
- Join technical communities
- Provide sufficient information when asking questions
Keep Learning
- Technology updates quickly
- Maintain the habit of learning
Recommended Learning Path
HTML/CSS/JS Fundamentals (2 weeks)
↓
Choose a Frontend Framework (2-3 weeks)
↓
Learn Backend Development (2-3 weeks)
↓
Build a Complete Project (3-4 weeks)
↓
Deploy Online (1-2 weeks)
↓
Continuous Improvement and Learning
Common Questions
Q: I have no programming background, can I learn?
A: Yes! As long as you persist in learning and make progress every day, you can build your own website in 1-2 months.
Q: Do I need to buy a server?
A: You can develop locally at first, and consider deployment after you have a working version. Servers aren't expensive, Alibaba Cloud ECS is ¥99/year, averaging about ¥8.25/month (~$1.15/month).
Q: What should I do when I encounter problems?
A:
- First, look at the error message and understand the problem
- Search for the error message to see how others solved it
- If that doesn't work, ask in technical communities
Q: How long does it take to build a website?
A: If you study 2-3 hours per day, you can build a complete website in 1-2 months.
Q: What technologies do I need to learn?
A:
- Frontend: HTML, CSS, JavaScript, React (or Vue)
- Backend: Python (or Node.js), FastAPI (or Express)
- Database: SQLite (simple) or MySQL (complex)
- Deployment: Linux basics, Nginx configuration
🌟 Final Words
Building a website from zero to one, the hardest part isn't the technology, it's getting started.
Don't wait until you're "ready" to start, start now:
- Open your computer
- Install Node.js and Python
- Follow a tutorial to make your first page
- Solve problems as you encounter them
- Keep improving
Remember:
- ✅ Every expert was once a beginner
- ✅ Every error is a learning opportunity
- ✅ Continuous learning is more important than talent
- ✅ Hands-on practice is more effective than just watching tutorials
Good luck! 🚀
This document is based on real project experience and is intended to help friends who want to build a website from scratch.
Last updated: November 2025