新手入门
欢迎来到 WordPress 新手入门指南!本章节将帮助你从零开始掌握 WordPress。
📚 课程大纲
mermaid
graph LR
A[安装 WordPress] --> B[基础配置]
B --> C[选择主题]
C --> D[安装插件]
D --> E[内容管理]
E --> F[SEO 优化]
F --> G[性能优化]
G --> H[安全防护]1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
🚀 快速开始
1. 环境要求
在安装 WordPress 之前,请确保你的服务器满足以下要求:
| 要求 | 最低配置 | 推荐配置 |
|---|---|---|
| PHP | 7.4+ | 8.0+ |
| MySQL | 5.7+ | 8.0+ |
| HTTPS | ✅ | ✅ |
| 内存 | 256MB | 512MB+ |
2. 安装方式
方式一:自动安装(推荐)
大多数主机提供商提供一键安装功能:
- 登录主机控制面板
- 找到"自动安装"或"Softaculous"
- 选择 WordPress 并点击安装
- 填写站点信息
方式二:手动安装
bash
# 下载最新版本
wget https://wordpress.org/latest.tar.gz
# 解压
tar -xzvf latest.tar.gz
# 移动到 Web 目录
mv wordpress /var/www/html/
# 设置权限
chown -R www-data:www-data /var/www/html/wordpress1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
3. 配置文件
编辑 wp-config.php:
php
// 数据库配置
define('DB_NAME', 'wordpress_db');
define('DB_USER', 'wp_user');
define('DB_PASSWORD', 'your_secure_password');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8mb4');
// 密钥配置(从 https://api.wordpress.org/secret-key/1.1/salt/ 获取)
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');
// 调试模式(生产环境设为 false)
define('WP_DEBUG', false);
// 站点 URL
define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
🎯 下一步
💡 小贴士
建议新手先使用本地环境练习,推荐使用 Local by Flywheel 或 Docker 搭建开发环境。
