Web-based file and folder sharing with Apache-HTTP server

Abstract

The post introduces how to make file sharing available using apache http server.

 

1. Introduction

 

File sharing is the practice of distributing or providing access to digital media, such as  computer programs, multimedia(audio, images, and video), documents or others. 

File sharing may be achieved in a number of ways, such as FTP, NFS, SAMBA, etc.  But web-based file sharing is a more convenient and user-friendly way to do so.

 

Apache is a web server that can do some very complicated things in conjunction with lots of other software but it can also be used on almost any computer to share files with other computers. 
 

2. Steps


Following is the steps of file sharing with apache http server version 2.4.x


1) install apache http server.
# sudo yum install httpd  (for centos/fedora)
# sudo pacman -S apache   (for archlinux)


2) modify apache http server's httpd.conf file and enable alias_module: 


# enable alias_module
LoadModule alias_module modules/mod_alias.so
LoadModule autoindex_module modules/mod_autoindex.so



3) add alias folder to share (within httpd.conf): 
for example:


# share folder
Alias /tmp C:/temp
<Directory  C:/temp>
    IndexOptions  FancyIndexing FoldersFirst  Charset=UTF-8  NameWidth=*
    Options  MultiViews  Indexes
    AllowOverride None
#Deny from 192.168.1.130
#Deny from 10.0.0.0/8
    Order allow,deny
    Allow from all


    #== Controls who can get stuff from this server
    Require all granted
</Directory>


 

# or as this:

<IfModule alias_module> 
   Alias /BaiduDownload "E:/BaiduYunDownload/" 
   <Directory "E:/BaiduYunDownload/"> 
Options Indexes MultiViews
IndexOptions FoldersFirst   Charset=UTF-8
AllowOverride None 
Require all granted
   </Directory> 
</IfModule>

 

 

 

# or in file "conf\extra\httpd-autoindex.conf"

 

IndexOptions FancyIndexing HTMLTable VersionSort FoldersFirst NameWidth=*
 
# We include the /icons/ alias for FancyIndexed directory listings.  If
# you do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "${SRVROOT}/icons/"
<Directory "${SRVROOT}/icons">
    Options Indexes MultiViews
    AllowOverride None
    Require all granted
</Directory>

 

 

#for Aapche 2.4.xx 版本:

# custom directory
Alias    /tmp    "c:/tmp"
<Directory "c:/tmp">
    Options  +Indexes
    IndexOptions FancyIndexing Charset=UTF-8 FoldersFirst NameWidth=* HTMLTable
    AllowOverride None
    Require all granted
</Directory>

 


Restart the httpd service , and you can access shared files and folder from your web browser.


That is all!

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值