nginx - 使用 nginx 使用 root 和 index 设置位置
问题描述
嗨,我想知道为什么在我的 nginx 服务器上设置位置时总是收到 404 错误。以下是我正在尝试做的事情:
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
}
location /api {
root html;
index index.html index.htm;
}
}
问题是 /api 位置调用。我只是在玩 ngnix,想知道为什么它找不到 html 文件。我认为这可能是root的问题。我需要设置的根和索引到底是什么才能使其在 / 位置路径中完全正常工作
解决方案
推荐阅读
- c# - 如何立即从异步循环中返回值?
- python - Pandas 根据前 n 行的条件过滤数据帧
- javascript - HapiJS 路由从请求返回响应
- python - 用于在 Django 中将字符串添加到模板的内置模板过滤器?
- c# - 这些代码的工作方式相同(具有基类约束的泛型类与非泛型类“对应”)
- windows - 从 Mimikatz 保护私有证书
- java - 在 ReactiveCrudRepository 上自动装配,使用 SpringBoot 的通用基础服务
- javascript - Angular 7 中的 HTTP GET 请求返回错误(状态 200)
- java - 如何将获取的 JSON 数据与 Room Persistence 库集成
- java - Java 发送电子邮件无一例外