Chevereto

Chevereto is a self-hosted image hosting tool designed for personal use. This article gives a brief introduction and includes a guide to deploying the free (community-supported) version.

BuildEnv

build Install Nginx

wget https://nginx.org/download/nginx-1.20.2.tar.gz
tar -zxvf nginx-1.20.2.tar.gz
cd nginx-1.20.2
./configure --prefix=/www/nginx --with-http_ssl_module --with-http_v2_module --with-http_image_filter_module --with-http_gunzip_module --with-http_slice_module --with-http_secure_link_module --with-http_gzip_static_module --with-http_stub_status_module --with-threads --with-file-aio --with-pcre
cp /usr/local/nginx/sbin/nginx /usr/bin/nginx
nginx -s reload
nginx
mginx -s stop

install Nginx

sudo tee /etc/systemd/system/nginx.service  << EOF 
[Unit]
Description=The NGINX HTTP and reverse proxy server 
After=syslog.target  network.target
 
[Service]
Type=forking 
ExecStartPre=/www/nginx/sbin/nginx -t 
ExecStart=/www/nginx/sbin/nginx 
ExecReload=/www/nginx/sbin/nginx -s reload 
ExecStop=/bin/kill -s QUIT \$MAINPID 
PrivateTmp=true 
 
[Install]
WantedBy=multi-user.target

EOF
sudo systemctl daemon-reload 
sudo systemctl enable nginx 
sudo systemctl start nginx 

install Php8

sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm  
sudo yum module reset php 
sudo yum module enable php:remi-8.2
yum install -y php php-fpm php-cli php-common php-mysqlnd php-gd php-mbstring php-xml php-curl php-zip php-opcache php-pecl-apcu
systemctl status php-fpm
systemctl start php-fpm
systemctl stop php-fpm

install MySQL8

sudo yum install -y https://dev.mysql.com/get/mysql80-community-release-el9-4.noarch.rpm  

sudo yum install -y mysql-community-server 
sudo systemctl enable mysqld 
sudo systemctl start mysqld 

sudo mysql_secure_installation 

mysql -u root -p <<EOF 
CREATE DATABASE chevereto CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'chevereto'@'localhost' IDENTIFIED BY 'StrongPassword@2025';
GRANT ALL PRIVILEGES ON chevereto.* TO 'chevereto'@'localhost';
FLUSH PRIVILEGES;
EOF 

install chevereto V3

sudo mkdir -p /var/www/chevereto 
sudo chown -R nginx:nginx /var/www/chevereto 
cd /var/www/chevereto 
sudo -u nginx wget https://github.com/chevereto/chevereto/archive/refs/tags/4.0.5.tar.gz  -O chevereto.tar.gz  
sudo -u nginx tar -xzf chevereto.tar.gz  --strip-components=1 
sudo -u nginx rm chevereto.tar.gz

settnig nginx

sudo tee /www/nginx/conf/chevereto.conf  <<EOF 
server {
    listen 80;
    server_name yourdomain.com; 
    root /var/www/chevereto;
    index index.php  index.html  index.htm; 
    
    access_log /www/nginx/logs/chevereto.access.log; 
    error_log /www/nginx/logs/chevereto.error.log; 
    
    location / {
        try_files \$uri \$uri/ /index.php?\$query_string; 
    }
    
    location ~ \.php$ { 
        include fastcgi_params;
        fastcgi_pass unix:/run/php-fpm/www.sock; 
        fastcgi_index index.php; 
        fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
    }
    
    location ~* \.(jpg|jpeg|gif|png|webp|svg|ico|css|js|woff|woff2)$ {
        expires 365d;
        add_header Cache-Control "public, no-transform";
    }
}
EOF 
 
sudo /www/nginx/sbin/nginx -t && sudo systemctl reload nginx 

setting OPcache

sudo tee /etc/php.d/10-opcache.ini  <<EOF 
zend_extension=opcache.so  
opcache.enable=1  
opcache.memory_consumption=256  
opcache.interned_strings_buffer=32  
opcache.max_accelerated_files=10000  
opcache.revalidate_freq=60  
opcache.fast_shutdown=1  
opcache.enable_cli=1  
EOF 
 
sudo systemctl restart php-fpm 

setting redis

sudo yum install -y redis 
sudo systemctl enable redis 
sudo systemctl start redis