chevereto 图床软件安装步骤

我购买了一个VPS,并且已经在VPS上搭建了Wordpress博客平台,其实Wordpress平台已经提供了图片上传功能。但自带的图片上传功能只能说够用,所以搭建一个自己的图床软件。官方安装步骤详见https://chevereto.com/docs/root-install,告诉可以直接跳转去那边看,效率更高。

一、准备工作

1.1、LNMP环境搭建

我们VPS平台为安装Wordpress已经安装好Nginx、PHP7.0、Mysql8。如果没有安装请先安装。PHP-FPM建议7.2及以上,因为chevereto,如果不是7.2级以上需要再安装一个PHP-XML。

1.2、数据库

  • 登入数据库

    mysql -uroot -p;
    
  • 创建数据库

    CREATE DATABASE chevereto;
    
  • 检查一下数据库是否创建成功

    show databases;
    

1.3、配置三级域名

在域名解析上增加一条三级域名A记录

image-20200415112400801

1.4、创建文件夹

  • 创建文件夹mkdir /var/www/img.zzhyun.com/public_html

  • 修改文件夹权限chown www-data:www-data /var/www/img.zzhyun.com/public_html/

    注意,这个文件夹下的所有文件必须是www-data权限,安装过程如出现下面现象请检查该文件夹及文件夹内文件权限是否正确

    image-20200415115308279

1.5、下载文件

需要将带有installer.php的代码下载到/var/www/img.zzhyun.com/public_html目录下

  • 直接下载源码https://github.com/Chevereto/Chevereto-Free
  • 下载安装文件https://github.com/Chevereto/installer再通过运行sudo -u www-data wget -O /var/www/img.zzhyun.com/public_html/installer.php将源码下载下来(我用这种方法,上面那种没有使用过)

1.6、配置Nginx

可以在/etc/nginx/sites-available中建立一个img.zzhyun.com的配置文件,并在/etc/nginx/sites-enable中使用ln -s /etc/nginx/sites-available/img.zzhyun.com /etc/nginx/sites-enable建立img.zzhyun.com软连接。配置文件如下:

#这里已经在wordpress中设置过了,我的img.zzhyun.com文件里没有这个配置选项
upstream php {
	server unix:/run/php/php7.0-fpm.sock;#这里根据自己安装的php版本具体修改
	server 127.0.0.1:9000;
}


server {
    listen         80;
    listen         [::]:80;
    #这里填写自己的域名
    server_name    img.zzhyun.com;
    #这里了根据自己将要安装图床地址具体设置
    root           /var/www/img.zzhyun.com/public_html;
    index          index.html;

    # Context limits
    client_max_body_size 20M;

    # Disable access to sensitive files
    location ~* (app|content|lib)/.*\.(po|php|lock|sql)$ {
        deny all;
    }

    # Image not found replacement
    location ~ \.(jpe?g|png|gif|webp)$ {
            log_not_found off;
            error_page 404 /content/images/system/default/404.gif;
    }

    # CORS header (avoids font rendering issues)
    location ~ \.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
            add_header Access-Control-Allow-Origin "*";
    }

    # Pretty URLs
    location / {
            index index.php;
            try_files $uri $uri/ /index.php$is_args$query_string;
    }

    location ~* \.php$ {
      #这里我就是使用upstream php
      fastcgi_pass php;
      include         fastcgi_params;
      fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
      fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
    }
}

二、网页安装流程

2.1、启动安装

在浏览器中输入安装网址img.zzhyun.com/installer.php,点击Continue

image-20200415133744471

2.2、选择免费版本

免费版选择Skip-Use Chevereto-Free,基本上免费版用作自己网站的图床已经完全够了,当然也可以购买收费版本,我没有试过,不建议破解版本,尊重版权

image-20200415134108390

2.3、数据库配置

这里不需要使用cPanel access来配置数据库,我们在上面已经建好了数据库,这里直接点击Skip跳过即可

image-20200415134942214

这里输入上面建立好的数据库,填入数据库名,数据库账号及密码,点Set database完成数据库设置

image-20200415134855209

2.4、设置图床登入邮箱、账号及密码

image-20200415135406287

image-20200415135506042

2.5、完成配置开始安装

提示即将开始安装图床,点Install Chevereto-Free开始安装

image-20200415135558372

等待完成安装

image-20200415135826938

2.6、完成安装

完成后会把所有的账号密码显示出来,自己保存好,方便后期管理

安装完成后系统会删除installer.php文件

image-20200415140034316

发表评论