Skip to content

English translation #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const config = {
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'zh-Hans',
locales: ['zh-Hans'],
locales: ['zh-Hans', 'en'],
},

presets: [
Expand Down
2 changes: 1 addition & 1 deletion i18n/en/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "The label for version current"
},
"sidebar.tutorialSidebar.category.开始": {
"message": "开始",
"message": "Getting started",
"description": "The label for category 开始 in sidebar tutorialSidebar"
},
"sidebar.tutorialSidebar.category.Tutorial - Extras": {
Expand Down
10 changes: 10 additions & 0 deletions i18n/en/docusaurus-plugin-content-docs/current/contributing.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
sidebar_position: 2
slug: /contributing
---

# Contributions

Typecho is an open-source project and we welcome anyone to contribute code, documentation or feedback.

[![Contributors](https://contrib.rocks/image?repo=typecho/typecho)](https://github.com/typecho/typecho/graphs/contributors)
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
sidebar_position: 3
---

# Backups

We recommend backing up data before site administrators perform risky operations such as upgrades, migrations, repairs, etc.

## `usr` directory

The files in the `usr` directory are, in general, files uploaded by the user themselves, such as themes, plugins, attachments, etc. These files will not be overwritten when you update Typecho, so there is no need to back them up.

However, if you are migrating your site, or if you are upgrading to a major version of Typecho, we recommend that you back up your usr directory.

There are many ways to back up the `usr` directory, such as using the `tar` command to package it into a compressed package:

```bash
tar -czvf usr.tar.gz /path/to/typecho/usr
```

## Database

Typecho stores data in a database, so we need to back it up.

### Back up the database using the "Backup" function

Typecho has a built-in functionality that allows to backup the database. You will find this option in the backend "Console" - "Backup".

![备份数据库](./img/backup.png)

Click the <kbd>Start Backup</kbd> button, Typecho will automatically back up the database and generate a backup file with the suffix `.dat` for automatic download. Please keep this backup file in a safe place, and you can also use it to restore data in the future.

:::warning
The data backed up by the "Backup" function only contains the data of the main program, if you use a third-party plug-in with its own data table,
The data from these tables is not backed up. If you want to back up this data, please refer to the method below.
:::

### Back up your database using a third-party tool

If you want to back up the entire database, including Typecho's datasheet and the datatable of third-party plugins, you can use a third-party tool such as `mysqldump`:


```bash
mysqldump -u username -p database_name > backup.sql
```

This command will export the data from the `database_name` database to the `backup.sql` file.

:::tip
`mysqldump` command requires the password for the database. If you don't want to enter your password in the terminal,, you can pass the `--password` parameter (note that this will make the password visible in your command history):

```bash
mysqldump -u username -p --password=your_password database_name > backup.sql
```
:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
sidebar_position: 4
---

# F.A.Q.

Docusaurus is a **static-site-generator** (also called **[Jamstack](https://jamstack.org/)**).

It builds your site as simple **static HTML, JavaScript and CSS files**.

## Build your site

Build your site **for production**:

```bash
npm run build
```

The static files are generated in the `build` folder.

## Deploy your site

Test your production build locally:

```bash
npm run serve
```

The `build` folder is now served at [http://localhost:3000/](http://localhost:3000/).

You can now deploy the `build` folder **almost anywhere** easily, **for free** or very small cost (read the **[Deployment Guide](https://docusaurus.io/docs/deployment)**).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
---
sidebar_position: 1
---

# Installation

## Requirements

If you need to install Typecho directly on your server, youl need to make sure your server meets the requirements below. If you are using Docker to install Typecho, you can skip this section.

### PHP runtime environment

Typecho is a PHP-based blogging program, and the latest version needs to run PHP 7.4 or higher. In addition, Typecho requires the following environment support:

- [Multibyte String support (MBString)](https://www.php.net/manual/book.mbstring.php)
- [JSON support](https://www.php.net/manual/book.json.php) _(enabled by default in PHP 8.0 and above)_
- If you use MySQL, you need [mysqli support](https://www.php.net/manual/book.mysqli.php) or [PDO MySQL support](https://www.php.net/manual/book.pdo.php),_(PDO Mysql is recommended)_
- If you use SQLite, you need [sqlite3 support](https://www.php.net/manual/book.sqlite3.php) or [PDO SQLite support](https://www.php.net/manual/book.pdo.php),_(PDO SQLite support is recommended)_
- If you use PostgreSQL you need [pgsql support](https://www.php.net/manual/book.pgsql.php) or [PDO PostgreSQL support](https://www.php.net/manual/book.pdo.php),_(PDO PostgreSQL support is recommended)_

:::tip
Typecho 1.2.x can run on PHP 7.2 or higher, while previous versions can run on PHP 7.0 or higher. However, we strongly recommend that you use PHP 7.4 or later for better performance and security.
:::

### Web servers

Typecho can run on any web server that supports PHP (or fastcgi protocol), including but not limited to:

- [Apache](https://httpd.apache.org/)
- [Nginx](https://nginx.org/)
- [IIS](https://www.iis.net/)
- [Lighttpd](https://www.lighttpd.net/)

:::note
In the example below, we use the default convention of `/srv/www/typecho` being the installation path of Typecho. You need to modify the path to fit your situation. `typecho.example.com` represents your domain name, you need to change it to your actual domain name.
:::

#### Apache recommended configuration

Apache needs to have installed either the module `mod_php` or `mod_fcgid`. In both cases, the `mod_rewrite` module needs to be installed.

Assuming the Apache configuration file is located in `/etc/apache2`, you can create the file `/etc/apache2/sites-available/typecho.conf` and add the following configuration:

```apacheconf
<VirtualHost *:80>
ServerName typecho.example.com
DocumentRoot /srv/www/typecho
<Directory /srv/www/typecho>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /srv/www/typecho/usr>
Options FollowSymLinks
Require all granted
</Directory>
<Directory "/srv/www/typecho/var">
Options -Indexes -FollowSymLinks
Require all granted
</Directory>
<FilesMatch "\.(htaccess|htpasswd|config\.inc\.php)$">
Require all denied
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
</VirtualHost>
```

#### Nginx recommended configuration

Assuming the Nginx configuration file is located in `/etc/nginx`, you can create the file `/etc/nginx/sites-available/typecho.conf` and add the following configuration:

```nginx
server {
listen 80;
server_name typecho.example.com;
root /srv/www/typecho;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
# 这里需要根据实际情况修改
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
```

:::warning
The `fastcgi_pass` directive here needs to be modified according to your actual system structure, so that Nginx can connect to PHP-FPM correctly.
:::

### Database

Typecho supports the following databases:

- [MySQL](https://www.mysql.com/),_(recommended version: MySQL 5.7 and above)_
- [PostgreSQL](https://www.postgresql.org/),_(recommended version: PostgreSQL 9.6 and above)_
- [SQLite](https://www.sqlite.org/),_(recommended version: SQLite 3.8 and above)_

:::note
We also support other branches of MySQL, such as MariaDB and Percona Server.However, we strongly recommend that you use the official version of MySQL for better compatibility and performance.
:::

## Start the service

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs defaultValue="docker" groupId="install">
<TabItem value="server" label="Install from the server">

From [the official website of Typecho](https://typecho.org/download), download the latest version of Typecho:

```bash
wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip
```

Unzip Typecho to the root directory of the web server:

```bash
unzip typecho.zip -d /srv/www/typecho
```

</TabItem>

<TabItem value="docker" label="Install from Docker">

You can use Docker to quickly deploy Typecho, just run the following command:

```bash
docker run -d -p 80:80 --name typecho -v ./typecho:/app/usr -e TYPECHO_SITE_URL=https://[YOUR DOMAIN NAME] -d joyqi/typecho:latest
```

</TabItem>

<TabItem value="docker-compose" label="Install with Docker Compose">

You can use Docker Compose to quickly deploy Typecho, just write the following `docker-compose.yml` file

```yaml title="docker-compose.yml"
version: '3.8'

services:
typecho:
image: joyqi/typecho:latest
ports:
- "80:80"
volumes:
- ./typecho:/app/usr
environment:
- TYPECHO_SITE_URL=https://[你的域名]
restart: unless-stopped
```

Then run the following command:

```bash
docker-compose up -d
```

</TabItem>
</Tabs>

In your browser, visit `https://[YOUR DOMAIN NAME]/install.php` and follow the prompts to complete the installation.

## Complete the installation

Visit the domain name configured above and you will see the installation interface of Typecho:

![Typecho installation](./img/install-start.png)

If everything is normal, you will see the <kbd>I am ready. Begin next step >></kbd> button; click it to continue.

In the subsequent installation process, you need to fill in the database information, administrator account information, etc., and follow the prompts to complete the installation.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
sidebar_position: 2
---

# Upgrade

:::tip
Before upgrading, be sure to back up your database and files.
:::

## Upgrade process

Choose the corresponding upgrade method according to your installation method.

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs defaultValue="docker" groupId="upgrade">
<TabItem value="server" label="Upgrade from server">

From the official [Typecho website](https://typecho.org/download) website, download the latest version of Typecho:

```bash
wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip
```

Unzip Typecho to the temporary directory:

```bash
unzip typecho.zip -d /tmp/typecho
```

:::tip
It is recommended to stop the webserver before performing file replacement to avoid file conflicts.
:::

Delete the following files and directories in the Typecho directory on the web server:

- `/admin/`
- `/var/`
- `/index.php`
- `/install.php`

:::caution
Please do not delete the `/usr/` directory, because this directory contains your theme, plug-ins and uploaded files, and it does not need to be upgraded.
:::

Upload/copy the following files and directories from the temporary directory to the Typecho directory on the web server:

- `/admin/`
- `/var/`
- `/index.php`
- `/install.php`

At this point, the upgrade is complete! Don't forget to start again the web server.

</TabItem>

<TabItem value="docker" label="Upgrade from Docker">

:::caution
The upgrade of the Docker container that contains Typecho requires the container to be recreated.
:::

Execute the following command to delete the old container and create a new container:

```bash
docker pull joyqi/typecho:latest
docker stop typecho
docker rm typecho
docker run -d -p 80:80 --name typecho -v ./typecho:/app/usr -e TYPECHO_SITE_URL=https://[YOUR DOMAIN NAME] -d joyqi/typecho:latest
```

</TabItem>

<TabItem value="docker-compose" label="Upgrade from Docker Compose">

To upgrade Typecho with Docker Compose, you only need to pull the image again and restart the container:

```bash
docker-compose pull
docker-compose down
docker-compose up -d
```

</TabItem>
</Tabs>

## Complete the upgrade

After the upgrade is complete, browse to the Typecho backend and log in as administrator. If there is a database upgrade operation, Typecho will automatically guide you through it.
Loading