官方链接 官方文档

民间China版网站链接 (实际下载地址已被官方以DMCA干掉了)

Github (已被官方以DMCA干掉)

部署环境

系统: Debian 11.1
Mariadb: v10.5.12
PHP: v7.4.28
Nginx: v1.18.0
chevereto-china: 基于chevereto-free v1.6.2改版

注意不要用PHP8,个人测试chevereto使用php8.1-fpm会出现错误

安装依赖

Mariadb
sudo apt update
sudo apt install mariadb-server
# 安装之后一般会自启动, 用以下命令查看运行情况
sudo systemctl status mariadb
# 开机启动mariadb
sudo systemctl enable mariadb
PHP
# 获取sury.org的gpg key
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
# 添加PHP仓库
sudo echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee etc/apt/sources.list.d/php.list
# 更新包
sudo apt update
# 安装PHP及其扩展依赖
sudo apt install php7.4 php7.4-{fpm,gd,curl,exif,imagick,mbstring,mysqli,pdo_mysql,zip}
# 启动php7.4-fpm, 默认监听9200端口
sudo systemctl start php7.4-fpm
# 开机启动
sudo systemctl enable php7.4-fpm
Nginx
# 安装nginx
sudo apt install nginx
# 启动nginx
sudo systemctl start nginx
# 开机启动
sudo systemctl enable nginx
# 查看版本
nginx -v

数据库准备

创建用户

以phpmyadmin为例

创建数据库

在创建用户的时候勾选 创建与用户同名数据库并授予所有权限,则已经自动创建好名为 chevereto的数据库

部署Chevereto

放置文件

解压程序到自己喜欢的路径,后续以 /var/www/chevereto为例

root@VM-20-5-debian:/var/www/cheveretochina# tree -L 1
/var/www/chevereto
├── app
├── cli.php
├── composer.json
├── composer.lock
├── content
├── images
├── importing
├── index.php
├── lib
└── sdk

一般Nginx会默认以www-data用户运行,如果不设置文件夹所有者或开放权限可能会导致访问403错误

sudo chown -R www-data /var/www/chevereto
# 或者
sudo chmod 777 -R /var/www/chevereto
配置Nginx

在上述安装依赖的时候已经启动Nginx,加上网站配置文件后重启即可

# 新建并编辑conf
vim /etc/nginx/sites-enabled/chevereto.conf
chevereto.conf
server {

    listen 80;
    listen [::]:80;

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name img.zakikun.com;

    # SSL
    ssl_certificate /etc/nginx/ssl/example.com/fullchain.pem;
    ssl_certificate_key /etc/nginx/ssl/example.com/privkey.pem;

    ssl_session_timeout 5m;
    ssl_session_cache shared:SSL:50m;
  
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
    ssl_prefer_server_ciphers off;

    # HSTS (ngx_http_headers_module is required) (63072000 seconds = 2 years)
    add_header Strict-Transport-Security "max-age=63072000; preload" always;

    # Force SSL
    if ($scheme = "http") {
        return 301 https://$host$request_uri;
    }

    # 关键, 指定chevereto网站目录
    root /var/www/chevereto;

    #if (!-e $request_filename) {
    #    rewrite ^(.*)$ /index.php$1 last;
    #}

    # Disable access to sensitive application files
    location ~* (app|content|lib)/.*\.(po|php|lock|sql)$ {
        return 404;
    }
    location ~* composer\.json|composer\.lock|.gitignore$ {
        return 404;
    }
    location ~* /\.ht {
        return 404;
    }

    # Disable log on not found images + image replacement
    location ~* \.(jpe?g|png|gif|webp) {
        log_not_found off;
        error_page 404 /content/images/system/default/404.gif;
    }

    # Enable CORS header (needed for CDN)
    location ~* \.(ttf|ttc|otf|eot|woff|woff2|css|js)$ {
        add_header Access-Control-Allow-Origin "*";
    }

    # Route dynamic request to index.php
    location / {
        index index.php;
        try_files $uri $uri/ /index.php$is_args$query_string;
    }

    location /admin {
        try_files $uri /admin/index.php?$args;
    }

    # .php调用php7.4-fpm处理
    location ~* \.php$  {
        include snippets/fastcgi-php.conf;
        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;
    }
}
重启Nginx
# 测试配置
sudo nginx -t
sudo nginx -s reload

配置chevereto

连接数据库

基础设置

最后点一下 Install Chevereto就安装完毕,访问网页即可使用

最后修改:2022 年 03 月 18 日
个人分享,随意打赏