Telegraph图床不再需要大盘鸡,人手一个图床

小夜MM5个月前 (11-01)建站笔记415

直接反代Telegraph造成图片内容不可控,想到star的Teleimg这款也是同类型程序

    使用Sqlite建立数据库筛选所有从本站上传的图片,非本站上传直接返回指定图片

    简单整合了一下,没剔除多余文件,养成习惯了,能用就好!



搭建环境需要PHP7.4,不然会报错
演示:https://dwz.ge/Mjpwe 或者 https://im.gurl.eu.org/
下载:https://dwz.ge/xOadP


Nginx伪静态

    if (!-e $request_filename) {
          rewrite ^(.*)$ /index.php$1 last;
    }
    location /file/ {
      log_not_found off;
      expires 30d;
      rewrite ^(.*)$ /index.php$1 last;
    }
    location /assets/ {
      etag on;
      gzip on;
      log_not_found off;
      expires 1d;
    }
    location ~* \.(db)$ {
      deny all;
    }

宝塔为例,网站配置文件添加反代

            location /upload {
                add_header Access-Control-Allow-Origin *;
                add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
                add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
                if ($request_method = 'OPTIONS') {
                        return 204;}
                proxy_pass https://telegra.ph/upload;
    }
    location /file {
                proxy_pass https://telegra.ph/file;
    }
    client_max_body_size 5m;

没想到那么简单的东西好多人都不会搞,录GIF供参考

转载自LOC:@乌拉擦

标签: Telegraph
分享给朋友:

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。