apache下局域网中其他机子要访问本机的web站点——修改http.conf方法

本文详细介绍了如何在http.conf文件中配置Apache HTTP服务器的访问权限,包括使用Order Deny, Allow指令来限制和允许特定IP地址的访问。

在http.conf在下面的这段话中找到下面这句话
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1   #把这里改成你想要的访问的本机的其他机子的ip地址如192.168.1.11,如果多个中间用空格隔开或者直接填写all(全部)



<Directory "D:/PHP/webroot/">

#
# 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 Indexes 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.
#

# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 192.168.1.12

</Directory>
httpd文件服务器 文件服务器访问路径:/data/bmsuploads(电池管理平台bms升级文件) /data/depmisfiles (电芯资源库系统附件) 下载由Nginx代理定向 安装参考: CentOS7中通过yum install httpd 安装httpd apache2的配置文件是/etc/apache2/apache2.conf httpd的配置文件是/etc/httpd/conf/httpd.conf 配置文件里面的内容大同小异,这边不做详细介绍,两者默认的访问端口都是80端口,当然这是可以在配置文件中进行修改的。 在配置文件中可以发现,服务器默认的访问路径在/var/www/html目录下。只是为了简单实现一台http文件服务器,因此可以在此目录下创建一个软连接来连接文件目录。 192.168.1.10这个节点作为安装包文件目录是/home/nn/package/,然后通过命令ln -s /home/nn/package/ file在/var/www/html/目录下创建了一个软连接。 在浏览器中就可以通过http://192.168.1.10/file访问到文件目录了,如下: 只要是同一个局域网的其它机子就都可以通过wget 192.168.1.10/file/xxx来下载安装包了。自此,完成自动化脚本的第一步 软连接: ln -s /data/bmsuploads /var/www/html 修改/新增指向的新路径 ln -snf /data/upload /var/www/html ln -snf /data/depmisfiles /var/www/html 安装好启动一下service httpd start 启动 service httpd restart 重新启动 service httpd stop 停止服务 现在httpd 是启动状态,软连接也没问题,可以上传文件,新上传的docx文件可以下载,但是无法下载zip文件:http://192.168.12.58:8999/mydownload/managefile/upload/2025/04/14/028aa411-1425-49d7-8848-b5e99b0ae126-BMSTestSystem_V1.53.zip
最新发布
10-25
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值