前言
我觉得对于博客而言一个本地私人图床还是相当重要的
当然白嫖也是不错的
由于我用的是Windows系统
不想用宝塔
所以就通过Nginx+php环境来搭建简单图床
一、下载Easylmages2.0简单图床
1.下载
最新版
稳定版
官方安装图床教程
2.解压并存放在web根目录里
解压压缩包并放在web根目录
部署Nginx + php
1.搭建Nginx + php环境
参阅Windows下搭建Nginx + php环境
!注:简单图床为2.8.3版本时.php版本应≤7.4
!php8.0环境下验证码不显示
lssies:159 此问题在最新版已解决
具体可参考7677b905
Nginx部署静态网页
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| 将 Https 下的内容注释取消 # HTTPS server #不要取消这个注释 # #server { listen 端口 # listen 443 ssl; 如果用ipv6 需要添加 listen [::]:443 ssl; server_name 服务名称 # server_name localhost; nginx上传默认限制是1M,会遇到403错误 需要添加 client_max_body_size 50m; ssl证书 后面对应路径,要用绝对路径 # ssl_certificate cert.pem; # ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on;
# location / { root 网页路径部署,要用绝对路径 # root html; index 主页 添加index.php # index index.html index.htm; # } 在这里添加php 可以将默认配置复制过来 location ~ \.php$ { root E:\Server\Website\bakaxiaofang.moe\EasyImages2.0-2.8.4; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } #} 如果直接用HTTPS 静态部署,不适用反代 在server 内添加 location ~ \.php$ { root E:\Server\Website\bakaxiaofang.moe\EasyImages2.0-master; root绝对路径,图床位置 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
|
示例如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| # HTTPS server # server { listen 2053 ssl; listen [::]:2053 ssl; server_name img.bakaxiaofang.moe; server_name img.localhost;
client_max_body_size 50m;
ssl_certificate E:\Server\Website\SSL\bakaxiaofang\_.bakaxiaofang.moe-chain.pem; ssl_certificate_key E:\Server\Website\SSL\bakaxiaofang\_.bakaxiaofang.moe-key.pem;
ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on;
location / { root E:\Server\Website\bakaxiaofang.moe\EasyImages2.0-2.8.4; index index.html index.htm index.php; } location ~ \.php$ { root E:\Server\Website\bakaxiaofang.moe\EasyImages2.0-2.8.4; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
|
打开有关图床的php插件
Fileinfo,iconv,zip,mbstring,openssl
Ctrl+F 搜索
1 2 3 4 5 6
| 取消以下注释,根据需要取消其它插件注释 ;extension=fileinfo ;extension=mbstring ;extension=openssl ;extension=zip ;extension=gd
|
php上传限制修改
file_uploads = On 文件上传 开On 关Off
upload_max_filesize = 2M 上传最大文件大小 修改为 upload_max_filesize = 50M
post_max_size = 8M POST最大大小 修改为 post_max_size = 100M
max_execution_time = 30 最大执行时间 单位/s 秒 修改为 max_execution_time = 600
max_input_time = 60 最大输入时间 修改为 max_input_time = 600
memory_limit = 128M 最大占用内存
图床配置
Eastlamge 安装环境检测 正常情况下检测结果全是✔️
网站域名与图片连接域名自行修改
管理密码 不要太简单
上传图片演示 图片来源奇诺777-Pixiv 116783746