0

我正在尝试让 nginx 通过

"your-domain.com/test" 

http://localhost:{9001}

我是 nginx 新手,并在以下方面取得了成功:

server {
    listen 80;

    server_name your-domain.com;

    location / {
        proxy_pass http://localhost:{9001};
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
    }
}

现在我可以将我的域传递到端口 9001。现在我想以这种方式进行调整,我可以将 your-domain.com/test 传递给 localhost:{9001}。这可能吗?我必须改变什么?

我试过了

location /test
server_name your-domain.com/test

两者都没有成功。

4

1 回答 1

1
location ~ /test

事实上,location 需要一个操作符 (=, ~ ...) 来匹配一个 uri。“位置/”的意思是“一切”。

于 2014-12-30T09:29:11.983 回答