发布于 2023-07-17 在 https://chenhaotian.top/linux-app/easy-image/
前言
如果不希望安装宝塔面板或其国际版 aapanel(尽管宝塔面板可以在安装后关闭),那么可以参考这篇文章。
本文安装环境为 Debian 11, 在 Ubuntu 20.04 测试通过
安装 PHP
安装 PHP 7.4
apt update -y
apt install php7.4 php7.4-fpm
安装 PHP 拓展
apt install php7.4-fileinfo php7.4-iconv php7.4-zip php7.4-mbstring php7.4-gd
配置 PHP
vim /etc/php/7.4/fpm/php.ini
查找 upload_max_filesize post_max_size memory_limit ,按需求设置。



重启 PHP
systemctl restart php7.4-fpm
安装 Nginx
安装 Nginx
apt install nginx
拉取网站代码
cd /var/www/html
git clone https://github.com/icret/EasyImages2.0.git
赋予适当权限
chmod -R 755 /var/www/html/EasyImages2.0/
chown -R www-data:www-data /var/www/html/EasyImages2.0/
配置 Nginx
rm /etc/nginx/sites-enabled/default
vim /etc/nginx/sites-enabled/default
填入以下配置,注意更改域名
此时不需要配置 443 监听和 SSL,之后由 Certbot 自动配置
server {
server_name image.example.com; # 你的域名
listen 80;
root /var/www/html/EasyImages2.0/;
index index.php index.html;
client_header_timeout 300s;
client_body_timeout 300s; # 防止大图片上传超时
client_max_body_size 2000m; # 应不小于100m,防止上传大图片 HTTP 413 错误
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location ~* ^/(config|docs|i|public)/.*\.(php|php5)$ {
deny all; # 安全设置
}
}
检查配置文件
nginx -t
如果出现以下内容表示正常
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
重启 Nginx
systemctl restart nginx
使用 Certbot 为 Nginx 配置 SSL 证书
apt install certbot python3-certbot-nginx
certbot --nginx -d your_domain #你的域名
测试证书自动更新
certbot renew --dry-run
安装环境部署完毕,访问你的域名即可进行网站初始化。
如果一切正常,检测结果应为全部通过。

注意事项 / 提示
-
官方 Github 仓库:https://github.com/icret/EasyImages2.0/
-
所有操作以 root 权限进行
-
Vim 的操作可自行寻找教程或询问 ChatGPT
-
更改 PHP 和 Nginx 配置文件后记得重启
systemctl restart php7.4-fpm systemctl restart nginx -
从其他图床迁移图片后记得更改图片权限为 0755 (或0644) 和 www-data
chmod -R 755 /var/www/html/EasyImages2.0/ chown -R www-data:www-data /var/www/html/EasyImages2.0/








![[MySQL] MySQL中的数据类型](https://img-blog.csdnimg.cn/61aab3d408b249d19edbace9a071b102.png)
![[黑马程序员Pandas教程]——Pandas读取保存数据](https://img-blog.csdnimg.cn/3adc25cf884347ef9ebf182a1e4796a0.png)



![【算法每日一练]-图论(保姆级教程 篇1(模板篇)) #floyed算法 #dijkstra算法 #spfa算法](https://img-blog.csdnimg.cn/737f0a7aba064b66935cb175d302571a.png)





