Git Product home page Git Product logo

file-server's Introduction

File Server

File Server is a platform to exchange files throgh a local network. it is a web stack that is based on nginx as web server, reverse proxy and Django web framework.

Table of contents

General Info

assume we want to share file sample.txt through this platform. first we should run the server on host computer that stores incoming files and serving files to other devices. then all devices should be connected to a single router (eg. home wifi network). now every device in this network can connect to host throgh a local network.

this service has an authorizaion method based on private ip addresses and a host admin should give privilages to users. otherwise they get a 403 error. the autorization is handled in two phases.first the nginx redirect all requests to a endpoint that acts as a registeration function. it captures client ip addresses and store them on a file named client_addresses.txt. so every client that visited the host ip address , is registered. then the host admin should pickup ip addresses from this file and write in the permited_client_ips.txt file. if client's ip is not in the permited_client_ips file , he/she does not have access to the host resources even she registered. the second and final phase is the ip_middleware that checks clients should be registered and authorized.

by using this service , you dont need to connect your device to host computer by usb cables. it needs internet connection at its boot time and can do jobs without that anymore.its secure and suits for personal or small businness that needs a file sharing network.

Technologies

  • Python 3.8
  • Django 3
  • Nginx
  • Bootstrap

Installation:

ubuntu

get the project from this repository. move to the project root direcotory and run the command: source config.sh

it will install the appropriate packages , install virual environment with python packages. then a prompt appeares that requires the user's name that every time she logs in to ubuntu with that.if it corrects create nginx server blocks , put environment variables in .env file.

Next and final step is

python3 run.py

that acts as an entrypoint. it populates nginx server blocks with appropriate data , migrate the database and run the django server. now every device is accecible throgh the host private ip address as url.to get its value see host_ip_address.txt file.

Note: to access other devices , put their ip addresses in permited_client_ips.txt file. like this:

    192.168.1.6
    192.168.2.3
    192.168.1.8
    192.168.1.11

Note: in config.sh the varible FILE_SERVER_PATH points to the location where all files recieves from clients stores here. change it to every location you want. also if you change that location you should this line to the same value. mkdir /home/vahid/file-server/ enjoy it :))).

other Unix like systems

change file config.sh based on your distribution. also in other unix systems the nginx config direcotry may differs from /etc/nginx. so read nginx documentations and change config.sh and run.py accordinglly. other parts works fine with these configurations.

have any comments? email me at [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.