There's an Ubuntu server configured with nginx and trojan proxy with x-ui. The nginx listens on public IP address port 443 and x-ui on 127.0.0.1 and can be on any port. trojan proxies also listens on 127.0.0.1, they use path variable on domain so nginx can forward related packages to specific port on 127.0.0.1
Every client proxy connects to 443 port and nginx will forward v2ray packets to 127.0.0.1 and the port that v2ray proxy listens.
This is my configuration file.
server {
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name myDomain.org;
location /2hehwk3h {
proxy_pass http://127.0.0.1:5473;
}
# This is where nginx forwards trojan proxy packets to 127.0.0.1
location ~ ^/style/item/([0-9]+)$ {
proxy_redirect off;
proxy_pass http://127.0.0.1:$1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
# V2Ray Panel Logs
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#listen 443 http2 ssl;
listen 443;
listen 80;
ssl_certificate /root/myDomain.org.crt;
ssl_certificate_key /root/myDomain.org.key;
}
My server has a ipv4 ip address and four ipv6 addresses. When I connect to proxy and search what is my IP address on google, some websites show my ipv4 address and some other ipv6.
Is there anyway to specify which IP should be used for which proxy profile?
As every profiles use a specific port on localhost, so I guess I can do something like this on nginx config file:
# I think I can add this block and specify the IP address (ipv4) here so every packets on the profile that configured on port 53243 will use ipv4.
location ~ ^/style/item/53243 {
proxy_redirect off;
proxy_pass http://127.0.0.1:$1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
# V2Ray Panel Logs
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# This is the configuration I have, I just have to set an IP address to be used as default here:
location ~ ^/style/item/([0-9]+)$ {
proxy_redirect off;
proxy_pass http://127.0.0.1:$1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
# V2Ray Panel Logs
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
But I'm not sure.
Is there anyway?