我想在子目录中使用html5mode app提供angular.js。
我在https://gist.github.com/cjus/b46a243ba610661a7efb使用此配置。
location /adm/ { # trailing slash here
alias share/nginx/html/dev2/; # and here as well
expires -1;
add_header Pragma "no-cache";
add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
try_files $uri$args $uri$args/ $uri/ /adm/index.html =404; # /adm/index.html and not /index.html
}
我总是转发到主目录。例如,当我转到/ adm / dashboard时,我被重定向到/