简体   繁体   English

如何在Nginx中使用try_file重写此nginx命令?

[英]How can I rewrite this nginx command with try_file in Nginx?

I want to hide jsp extension in url by Nginx. 我想通过Nginx在URL中隐藏jsp扩展名。 How can I rewrite this nginx command with try_file in Nginx? 如何在Nginx中使用try_file重写此nginx命令?

location ~ .*\.jsp$ {
    root   /var/www/html/www.domain.com;
    if (!-f $request_filename) {
        rewrite ^/(.*)$ /index.jsp?q=$1;
        break;
    }
location ~ \.jsp {
    try_files $uri /index.jsp?q=$request_uri;
}

http://wiki.nginx.org/IfIsEvil http://wiki.nginx.org/IfIsEvil

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM