nginx反向代理IPv6配置
项目是集群环境,要求IPv4/IPv6双栈支持,nginx反向代理配置如下:upstream sa{
server 172.16.0.216:8080; #SA Server1
server 172.16.0.232:8080; #SA Server2
}
upstream sa_ipv6{
server :8080; #SA Server1
server :8080; #SA Server2
}
server {
listen 80; ## listen for ipv4
server_name localhost;
location / {
#index index.html;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://sa;
}
}
server {
listen [::]:80 ipv6only=on; ## listen for ipv6
server_name localhost;
location / {
#index index.html;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://sa_ipv6;
}
}
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页:
[1]