Build a free image hosting with Telegraph
Important
Starting from September 6, 2024, Telegram officially discontinued the upload feature of Telegraph, rendering this project no longer functional.
This project should be able to perfectly replace Telegraph.
- Free
- Unlimited bandwidth (It will consume the traffic of your VPS)
- No censorship (NSFW image can be uploaded)
- You can upload any file, not just image files
- Single file cannot exceed 5MB
- Access speed may not be ideal in China Mainland
Full enable HTTPS
Client -> Cloudflare Server (Optional) -> Your VPS (Example: Oracle Cloud) -> Telegraph Servers (NL)
- a Domain (Make sure it's not blocked by GFW)
- an overseas VPS (Make sure you can access Telegraph)
- Install Nginx
I don't talk too much about simple steps such as domain name resolution and SSL certificate application.
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;
Note: Remove all other useless location
related configuration and just keep the two above.
Thanks to my best friend Svend (author of uPic) for guiding the configuration scheme
- You can change the
API URL
andDomain
to your own.
- Don't forget to click on the
Other fields
to add the header information.
- Connect your server by SSH, then enter your web directory.
cd /www/wwwroot/xxx.com
- Download the source code on GitHub with
wget
.
wget https://raw.githubusercontent.com/missuo/Telegraph-Image-Hosting/main/index.html
-
Modify the API
https://missuo.ru/upload
to your domain. -
Have fun.
There is no guarantee that the Telegraph will work all the time, as it is on the GFW list. However, when you can use it, make sure to cherish it!
Telegraph-Image-Hosting © Vincent Young, Released under the MIT License.