apache:
httpd.conf 文件的 </Directory> 后加如下代码
Alias /aa "D:/MyPHP"
<Directory "D:/MyPHP">
Options Indexes FollowSymLinks
AllowOverride all
#AllowOverride None
Order allow,deny
allow from all
Require all granted
</Directory>
注:(自己测试所得)
Require all granted 不加会出现无权限访问
llowOverride : 为none 同盘符可用 跨盘符不行
为all 所有的都可以用
nginx目录映射配置 :
使用场景:www.xxx.com的images目录要映射要另外一个文件夹下/upload
配置如下(红色字体为配置)
在nginx.conf文件中
server {
listen 80;
server_name game.img.xxx.com;
location ~ ^/images/(.*)
# location ~ ^/images/(.*.jpg)
#“.”表示任何字符,“*”表示任意数量
#“.jpg”表示jpg后缀名的文件
{
expires 1s;
alias E:/upload/$1; #“$1”表是location后面()的内容
index index.html index.htm;
break;
}