nginx 無法正常顯示未加斜線的網址
server {
listen 80;
server_name localhost;root /usr/share/nginx/html;
index index.html;
location / {
add_header x-uri $uri;
try_files $uri $uri/ @rewrites;
}location @rewrites {
rewrite ^\/([a-zA-Z0-9]+).*$ /$1/index.html last;
}location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
# Some basic cache-control for static files to be sent to the browser
expires max;
add_header Pragma public;
add_header Cache-Control “public, must-revalidate, proxy-revalidate”;
}}
結果將 $uri/ 拿掉後重啟就正常了