nginx服务器位置路由

时间:2019-07-24 12:14:52

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

它是我的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 中的应用程序>文件夹。

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

1 个答案:

答案 0 :(得分:0)

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

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

官方文档here和格式良好的Linode here