Score:1

Specify IP address for V2ray + nginx

in flag

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?

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.