下面这样写的话,出现 sample.com/abc 就会因为 /abc 不存在,出 404 错误。想把 URL 请求里的所有参数都忽略。
server {
listen 443 ssl;
server_name sample.com;
ssl on;
ssl_certificate /etc/ssl/sample.com.pem;
ssl_certificate_key /etc/ssl/sample.com.key;
ssl_prefer_server_ciphers on;
access_log off;
error_log off;
location / {
root /usr/local/nginx/html;
index index.html index.htm;
}
}
1
Hyseen 2019-12-21 16:43:28 +08:00 1
```
location / { try_files $uri $uri/ /index.html; } ``` |
2
withoutxx 2019-12-21 16:45:53 +08:00 via iPhone
搜索 nginx spa
|
3
KuroNekoFan 2019-12-21 16:57:22 +08:00
try_files index.html =404;
|