在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Linux  網(wǎng)絡安全/ nginx中是設置虛擬目錄為什么不生效?

nginx中是設置虛擬目錄為什么不生效?

nginx版本:1.12.1
nginx虛擬主機配置如下:

server{
    listen 80;
    server_name abc.local;
    index index.html index.htm index.php;
    root  /opt/tool/web;
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
    location /test {            
        alias /opt/tool/web/cdn/;
    }
    location = /robots.txt {
        allow all;
        log_not_found off;
         access_log off;
    }
    include enable-php.conf;
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
          expires      30d;
    }

    location ~ .*\.(js|css)?$ {
          expires      12h;
    }

    access_log off;
}

此配置文件在servers目錄下
nginx.conf 通過

include servers/*;

引入。
訪問. http://abc.local/test/1.jpg
出現(xiàn)404
查看nginx錯誤日志

[error] 36523#0: *63 open() "/opt/tool/web/test/1.jpg" failed (2: No such file or directory), client: 127.0.0.1, server: abc.local, request: "GET /test/1.jpg HTTP/1.1", host: "abc.local"

我在test這個虛擬目錄中設置是的
/opt/tool/web/cdn/
為什么不生效,他還要去訪問root /opt/tool/web 這個目錄?

回答
編輯回答
初心

clipboard.png

一圖見分曉

2018年6月11日 10:47