搭建文件服务器

Posted 朱永胜

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了搭建文件服务器相关的知识,希望对你有一定的参考价值。

下载httpd

yum install -y httpd

看看成功了没有

http://localhost

配置监听端口和隐藏目录

vim /etc/httpd/conf/httpd.conf

修改端口

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 9090

去掉Indexes,这样页面就看不到目录结构了

<Directory "/var/www/html/file">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn\'t give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options   FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
systemctl restart httpd
netstat -nltp | grep 9090

指定目录

先到默认的映射地址下

cd /var/www/html/

接下来加一个软件映射存放文件的目录

ln -s /opt/file/ file

访问

http://localhost:9090/file/

以上是关于搭建文件服务器的主要内容,如果未能解决你的问题,请参考以下文章

spring练习,在Eclipse搭建的Spring开发环境中,使用set注入方式,实现对象的依赖关系,通过ClassPathXmlApplicationContext实体类获取Bean对象(代码片段

CentOS 7.6 搭建Gitlab教程

使用 Vue + Flask 搭建单页应用

VSCode自定义代码片段——.vue文件的模板

VSCode自定义代码片段2——.vue文件的模板

在PaddlePaddle中的Notebook代码片段