你好,我有django应用程序让我们假设我的网站uri是example.com现在我想路由我的管理 Jmeter 板到另一个端口,就像如果用户类型abc.example.com
它自动路由到我的应用程序的主页,但我想有abc.example.com:445/admin/*
是可能的解决方案,我尝试了
server {
listen 443 ssl;
server_name abc.example.com;
client_max_body_size 500M;
ssl_certificate /etc/nginx/my.crt;
ssl_certificate_key /etc/nginx/server.key;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://localhost:3001;
}
}
server{
listen 445 ssl;
server_name abc.example.com;
client_max_body_size 500M;
ssl_certificate /etc/nginx/my.crt;
ssl_certificate_key /etc/nginx/server.key;
location /admin {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://localhost:3001;
}
}
server {
listen 80;
server_name abc.example.com;
return 301 https://$host$request_uri;
}
但这本身路由到端口443和/管理页面也有,所以如何避免这种任何可能的解决方案.
1条答案
按热度按时间fhity93d1#
对于管理路由,您需要从443重定向到445,与从80 =〉443重定向类似。
所以在你听443的部分,你需要