diff --git a/server/conf/nginx_vhost.conf.master b/server/conf/nginx_vhost.conf.master
index e00a892fece390ee61e6aa97d98bae5dd402e0fc..bfa94f8fb3b3d3eaf81a4fffb25678bd3c7e8fc7 100644
--- a/server/conf/nginx_vhost.conf.master
+++ b/server/conf/nginx_vhost.conf.master
@@ -338,15 +338,15 @@ server {
 
 <tmpl_loop name="redirects">
 server {
-        listen <tmpl_var name='ip_address'>:80;
+        listen <tmpl_var name='ip_address'>:<tmpl_var name='http_port'>;
 <tmpl_if name='ipv6_enabled'>
-        listen [<tmpl_var name='ipv6_address'>]:80;
+        listen [<tmpl_var name='ipv6_address'>]:<tmpl_var name='http_port'>;
 </tmpl_if>
 
 <tmpl_if name='ssl_enabled'>
-        listen <tmpl_var name='ip_address'>:443 ssl;
+        listen <tmpl_var name='ip_address'>:<tmpl_var name='https_port'> ssl;
 <tmpl_if name='ipv6_enabled'>
-        listen [<tmpl_var name='ipv6_address'>]:443 ssl;
+        listen [<tmpl_var name='ipv6_address'>]:<tmpl_var name='https_port'> ssl;
 </tmpl_if>
         ssl_certificate <tmpl_var name='ssl_crt_file'>;
         ssl_certificate_key <tmpl_var name='ssl_key_file'>;