Question

how to upload and share a file on ubuntu vps

hi everyone , on my vps , i have a v2ray panel on sub1.mydomain.com:8880 and a panel on sub1.mydomain.com:8081 , now i need to create a subscribe file for my v2ray users and share it, so everyone can download this file from my vps , for example when someone goes to :

mydomain.com/sub/sub1.txt or sub1.mydomain.com/sub/sub1.txt

they manage to open or download this file from my vps . how can i do it ?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
May 5, 2023

Heya @driftinglightcyanurchin,

So after you are using v2ray, I would assume you are using Nginx as a reverse proxy. In that case in your Nginx configuration for your both mydomain.com and sub1.mydomain.com you can add the following Nginx block:

location /sub/ {
    alias /var/www/sub/;
    autoindex off;
    try_files $uri =404;

    add_header Content-Disposition "attachment; filename=$1";
}

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel