2022年3月

1. 安装nginx

sudo apt-get install nginx

2. 安装PHP

sudo apt-get install php-fpm php-sqlite3 php-mbstring

3. 简单配置nginx

编辑/etc/nginx/sites-enabled/default文件:

  • 这里增加index.php类型:
    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html index.php;
  • 打开PHP的解析:
    # pass PHP scripts to FastCGI server
    #
    location ~ \.php(\/.*)*$ {
            include snippets/fastcgi-php.conf;

            # With php-fpm (or other unix sockets):
            fastcgi_pass unix:/var/run/php/php-fpm.sock;
            # With php-cgi (or other tcp sockets):
            #fastcgi_pass 127.0.0.1:9000;
    }
  • 注意: location那里不能用默认的写法,否则某些页面会打不开.

4. 安装typecho

  • 下载当前的稳定发行版:
wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip
  • 解压并复制到/var/www/html:
cd /var/www/html
unzip typecho.zip
  • 修改权限. nginx和php-fpm默认都是www-data用户, 所以必须修改/var/www/html目录的用户为www-data. 否则typecho无法创建文件.
chown www-data:www-data /var/www/html -R

5. 安装完成!

现在, 可以输入你的服务器地址, typecho的页面会提示你一步一步安装的.