首页 > 解决方案 > nginx服务器定位路由

问题描述

它是我的 nginx 配置文件

server {
    listen 80;
    server_name san.cashbaba.com.bd www.san.cashbaba.com.bd;
    location / {
        proxy_pass http://localhost:3000;
                proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

}

它现在工作正常。我的要求是,如果有人在浏览器地址栏中写入san.cashbaba.com.bd/admin然后打开另一个应用程序,该应用程序已经存储在/usr/share/nginx/html/adminApp文件夹中。

任何人都可以帮助我如何在此配置文件中编写此配置

标签: nginxnginx-locationnginx-reverse-proxynginx-ingress

解决方案


您可以像这样指定另一个位置块,nginx 将对每个请求应用最具体的匹配。

location /admin {
    root /usr/share/nginx/html/adminApp
    index index.html index.htm;
}

此处的官方文档和此处的 Linode 格式的良好文档


推荐阅读