【整理】apache设置笔记

apache架设网站局域网访问403:在httpd中找到
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
把127.0.0.1改成服务器在内网中的地址或者直接为all就可。

禁止下载:
<directory d:/wamp/www/aic/disk>
<FilesMatch "\.(rar|txt|doc|xls|ppt|bmp)">
Order Deny,Allow
Deny from all
</FilesMatch>

</directory>

<Directory "D:/wamp/www">
Options SymLinksIfOwnerMatch
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://localhost.*$ [NC]
RewriteCond %{HTTP_REFERER} !http://172.23.167 [NC]
RewriteRule .*\.(gif|jpg|jpeg|JPG|)$ - [F]
</Directory>
禁止列目录:
Options Indexes FollowSymLinks
去掉indexes

防止域名恶意绑定

<VirtualHost *>
DocumentRoot /var/www/html/yukon12345.com
ServerName www.yukon12345.com
ServerAlias yukon12345.com
</VirtualHost>
<VirtualHost *>
RedirectMatch ^/(.*) http://www.baidu.com

</VirtualHost>


开启.htaccess:

AllowOverride All

或者

AllowOverride FileInfo


在本地使用虚拟主机如e.com访问 本地网站

改主机host文件:添加 127.0.0.1 e.com

改apache的httpd-vhosts.conf,添加

<VirtualHost *:80>
ServerName e.com
DocumentRoot d:/wamp64/www/ipad/web
  ErrorLog "logs/eovas-error.log"
    CustomLog "logs/eovas-access.log" common
<Directory  "d:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值