Bet*_*eto 11 nginx domain reverse-proxy subdomain
我是 nginx 的新手,但我需要根据子域创建一些代理规则以重定向到另一个 IP 和端口。
这是我的情况:
My domain.com has IP y.y.y.y and accepts requests on port 80
My subdomains are:
- admin.domain.com -> I need to proxy to x.x.x.x:3434
- user.domain.com -> I need to proxy tox.x.x.x:3435
- vendor.domain.com -> I need to proxy to x.x.x.x:3436
Run Code Online (Sandbox Code Playgroud)
所有子域都映射到y.y.y.y
但在 nginx 中我需要代理到x.x.x.x:ZZZ
(ZZZ 是其他服务的特定端口)。
我正在尝试这个例子但没有成功:https : //rainbow-six3.com/plesknginx/
有人可以提供一个示例,如何在 nginx 上配置它?
Bet*_*eto 18
server {
listen 80;
server_name admin.domain.com;
location / {
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:3434;
proxy_redirect off;
}
}
server {
listen 80;
server_name user.domain.com;
location / {
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:3435;
proxy_redirect off;
}
}
server {
listen 80;
server_name vendor.domain.com;
location / {
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:3436;
proxy_redirect off;
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
24307 次 |
最近记录: |