nginx - NGINX 不会在自定义目录中提供 html
问题描述
我有以下配置。
events {}
http {
include mime.types;
server {
listen 80;
root /home/john/example;
server_name example.com; # <----------- I want this to work!
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
server {
listen 80;
root /home/john/app;
server_name app.domain.com;
location / {
proxy_pass 'http://127.0.0.1:3000';
}
}
server {
listen 80;
root /home/john/admin;
server_name admin.domain.com;
location / {
proxy_pass 'http://127.0.0.1:3001';
}
}
}
该index.html
文件位于/home/john/example
目录中。
无论我尝试什么,添加配置并重新加载它,example.com 都不会返回任何内容。
其他的(proxy_passes)正常工作。
我做错了什么,一切都完全按照指南所说的那样。
请注意,同一台服务器上有两个域,这不是错字。
解决方案
推荐阅读
- awk - 使用范围表达式过滤表格文件
- google-apps-script - 如何使用 Google Apps 脚本在 Google Forms 中进行简单的身份验证?
- mirth - Mirth -> HL7 到 XML 转换问题
- javascript - Firestore 自定义声明未更新 UI
- javascript - 如何运行编写在外部 js 文件中的 npm 脚本(package.json)?
- nestjs - 具有单独实体定义的迁移
- r - 为分组后的列添加原始值
- c - 在每个文件中创建相同的#define
- javascript - 如何在渲染后动态取消选中和选中星云复选框
- date - 如何计算机器在线的百分比