zoukankan      html  css  js  c++  java
  • Apache搭建简单的图片访问服务器

    安装apache后,修改httpd.conf文件

    将根目录修改为你图片所在目录

    DocumentRoot有这么一行,修改成你要指向的路径
    DocumentRoot "/yang/pic"  我的路径

    再修改一下 Directory的路径 要求和上边的一致

    <Directory "/yang/pic">
    
    #
    # 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.2/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 all
    
    #
    # Controls who can get stuff from this server.
    #
        Order allow,deny
        Allow from all
    
    </Directory>

    接下来是权限的设置,因为完成上边的设置后,如果访问你的图片路径,是能够看到目录下所有图片等文件的。

    所以要求他不能访问路径

    进入apache的配置文件 httpd.conf 找到: 在 配置访问目录处设置

    Options Indexes FollowSymLinks
    修改为:
    Options FollowSymLinks
    

    这样在 yang/pic 目录下的图片 就可以通过地址访问了

    一般默认的端口为80,可以通过配置文件修改,

    Listen 81   找到这个位置,我改成了81端口
  • 相关阅读:
    centos 7 pip install MySQL-python 报错
    修改centos history记录数上限
    CentOS 7 如何设置为eth0网卡
    字符串判空有空格报错:binary operator expected
    Linux指定用户运行程序
    MySQL 新建用户,为用户授权,指定用户访问数据库
    解决linux 中文乱码
    UNIX目录访问操作
    通过lseek产生空洞文件
    lseek系统调用
  • 原文地址:https://www.cnblogs.com/wanyong-wy/p/10435425.html
Copyright © 2011-2022 走看看