开发者

how to excluded directory from nginx conf?

开发者 https://www.devze.com 2023-01-05 10:04 出处:网络
in nginx conf file,i use: location ~ \\.jsp { proxy_pa开发者_开发问答sshttp://127.0.0.1:86; } to parse my jsp file, now,i want excluded directory /upload/

in nginx conf file,i use:

location ~ \.jsp {
    proxy_pa开发者_开发问答ss   http://127.0.0.1:86;
}

to parse my jsp file, now,i want excluded directory /upload/

this directory is user upload file directory ,don't need parse JSP file.(http://example.com/upload/)

how to change my location ~ \.jsp { ?

i need parse JSP *.jsp but excluded /upload/ and it's subdirectory.

thanks all :)


Here is a list of Nginx Core Directives:
http://wiki.nginx.org/NginxHttpCoreModule

By skimming through these I can see there's probably more than one way to achieve this. I can't test it, but here's something that may work:

error_page 403 /forbidden.html;
location ^~ /upload/ {
    deny all;
}

However, I would advise against this; your upload directory should never sit inside your web root. You should simply move the folder to achieve what you're asking.

0

精彩评论

暂无评论...
验证码 换一张
取 消