how to do simple math calculation for variable in nginx configuration file
<p>Is there anyway I can do simple math calculation for ngnix configuration file. Lets say I want to do proxy pass based on host domain. I am able to redirect host to correct port number when prefix comes with 0 to 9. However what I really want is prefix10 to port 1410. but based on my configuration right now, it will proxy to port 14010</p>

<p>Host:<br>
<a href="http://prefix0.domain.com" rel="nofollow noreferrer">http://prefix0.domain.com</a> -> 127.0.0.1:1400<br>
<a href="http://prefix10.domain.com" rel="nofollow noreferrer">http://prefix10.domain.com</a> -> 127.0.0.1:1410<br>
<a href="http://prefix99.domain.com" rel="nofollow noreferrer">http://prefix99.domain.com</a> -> 127.0.0.1:1499<br></p>

<pre><code>server {
    listen       80;
    server_name ~^(prefix(?&lt;variable&gt;[0-9]+)).domain.com;

    location  / {
        proxy_pass http://127.0.0.1:140$variable;
    }
}
</code></pre>