【问题标题】:nginx server location routenginx服务器定位路由
【发布时间】:2019-12-02 14:16:38
【问题描述】:

这是我的 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 > 文件夹。

谁能帮我在这个配置文件中写这个配置

【问题讨论】:

  • /usr/share/nginx/html/adminApp 文件夹中有什么? html/css/js 文件还是别的什么?
  • @RichardSmith 我在 AdminApp 文件夹中的另一个项目。我想如果我写 mydomain/AdminApp 然后这个应用程序打开

标签: nginx nginx-location nginx-reverse-proxy nginx-ingress


【解决方案1】:

你可以像这样指定另一个位置块,nginx 会在每个请求上应用最具体的匹配。

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

官方文档here和一个好的文档形式 Linode here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-11
    • 1970-01-01
    • 1970-01-01
    • 2014-05-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多