{"id":22514,"date":"2025-10-15T21:51:54","date_gmt":"2025-10-15T18:51:54","guid":{"rendered":"https:\/\/trueconf.com/blog\/?p=22514"},"modified":"2026-03-24T17:25:55","modified_gmt":"2026-03-24T14:25:55","slug":"how-to-configure-port-forwarding-on-trueconf-server-for-linux","status":"publish","type":"post","link":"https:\/\/trueconf.com/blog\/knowledge-base\/how-to-configure-port-forwarding-on-trueconf-server-for-linux","title":{"rendered":"How to configure port forwarding (proxying) on TrueConf Server for Linux"},"content":{"rendered":"<p>The TrueConf Server messenger provides chat and video communication within a corporate network. If the server needs to be accessible from outside the network (from the internet), web services are often placed behind a reverse proxy for security reasons. <\/p>\n<p>A <b>reverse proxy<\/b> is a dedicated node (service) in the network infrastructure that is configured to forward traffic from client devices to the company&#8217;s web servers, hiding the real addresses of these servers from the external network. In our case, this means the TrueConf Server web service will be shielded from direct external access. We will use NGINX as the proxy.<\/p>\n<div class=\"accent-note accent-note--line ui-mb-sm-1 ui-mt-xs-3\">\n<p class=\"primary-medium-text\">\nTrueConf Technical Support <b>does not recommend<\/b> routing media traffic through NGINX, even though it is technically possible. We cannot guarantee the stable operation of NGINX when handling large volumes of media traffic. All traffic on port 4307, which uses the proprietary TrueConf protocol, is encrypted with the AES-256 algorithm; therefore, using a firewall is considered sufficient for securing this connection.\n<\/p>\n<\/div>\n<p>In our case the proxy machine will run Debian 11; the following software will be installed:<\/p>\n<ul>\n<li>NGINX \u2013 <b>1.22.0<\/b>, <a href=\"https:\/\/nginx.org\/en\/download.html\" target=\"_blank\" rel=\"noopener\">official website<\/a>;<\/li>\n<li>TrueConf Server \u2013 <b>5.0.3<\/b>, the latest versions <a href=\"https:\/\/trueconf.com\/products\/tcsf\/trueconf-server-free.html\" target=\"_blank\" rel=\"noopener\">can be downloaded from the TrueConf website<\/a>;<\/li>\n<li>firewalld \u2013 <b>0.9.3<\/b>, the standard firewall for Linux, we will install it from the repositories.<\/li>\n<\/ul>\n<p class=\"primary-medium-text ui-mb-sm-1 ui-mt-xs-3\">If you are running TrueConf Server on Windows, you can also install NGINX, in which case the general configuration logic remains the same.<\/p>\n<h2>Proxy server configuration<\/h2>\n<p>We first have to configure NGINX as a proxy for the TrueConf Server web service. In our configuration, it will proxy the traffic coming to the standard HTTP and HTTPS ports: <b>80<\/b> and <b>443<\/b> respectively. If you are using different ports (check the <a href=\"https:\/\/docs.trueconf.com\/server\/en\/\" target=\"_blank\" rel=\"noopener\">server documentation<\/a> if you want to change them), you will need to specify them in the corresponding lines in the settings below.<\/p>\n<p>To configure the proxy server, you will need to write directives in the configuration file. By default this file is called <b>nginx.conf<\/b> and can be found in one of the following directories:<\/p>\n<ul>\n<li><code>\/etc\/nginx<\/code>;<\/li>\n<li><code>\/usr\/local\/nginx\/conf<\/code>;<\/li>\n<li><code>\/usr\/local\/etc\/nginx<\/code>.<\/li>\n<\/ul>\n<p>Directives should be placed within the <b>server { \u2026 }<\/b> block. Please take these steps:<\/p>\n<ol>\n<li>Specify the ports that will be listened to: <b>80<\/b> and <b>443<\/b>.\n<pre class=\"lang:default decode:true \"> listen 80 default_server;\r\n listen [::]:80 default_server;\r\n\r\n listen 443 ssl default_server;\r\n listen [::]:443 ssl default_server;\r\n<\/pre>\n<\/li>\n<li>Specify the path to the SSL certificate and its key to configure HTTPS connection for NGINX (if you do not have the certificate, you can generate it with the <a href=\"https:\/\/www.openssl.org\/docs\/\" target=\"_blank\" rel=\"noopener\">OpenSSL<\/a> library). Once you have completed this step, it is no longer necessary to configure HTTPS on the side of TrueConf Server because the traffic will be encrypted by the proxy server.\n<div class=\"marked_note marked_note--warning\">An HTTPS connection is required for the TrueConf Server API to operate. Without it, you won&#8217;t be able to obtain an OAuth2 token to work with the API.<\/div>\n<pre class=\"lang:default decode:true \"> ssl_certificate \/etc\/example\/certificate.crt;\r\n ssl_certificate_key \/etc\/example\/cert-key.key;\r\n<\/pre>\n<\/li>\n<li>Write the location block with the configuration for proxying\n<pre class=\"lang:default decode:true \"> location \/ {\r\n    proxy_pass https:\/\/192.168.10.1:443;\r\n    proxy_ssl_verify off;\r\n    proxy_set_header Host $host;\r\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n    proxy_set_header X-Real-IP $remote_addr;\r\n }\r\n<\/pre>\n<p>In the proxy_pass directive, specify the internal address of TrueConf Server in your local network. It will be available to the host from NGINX. This directive will make sure that the traffic coming to the ports specified previously will be routed to the selected address. In addition to proxying, this block will configure the transfer of HTTP headers and disable the verification of the SSL certificate.<\/li>\n<li>If users may connect to the server via WebRTC (from a browser), write another block called location from a new line after the previous block. This new block will include the configuration for proxying WebSocket requests to the port <b>4309<\/b>. This port is used for sending signaling or controlling traffic (between the video conferencing server and the browser client application). In this way, you will make sure that the web server is not excessively loaded with traffic processing.\n<pre class=\"lang:default decode:true \"> location \/websocket\/ {\r\n    proxy_pass http:\/\/192.168.10.1:4309\/websocket\/;\r\n    proxy_http_version 1.1;\r\n    proxy_set_header Upgrade $http_upgrade;\r\n    proxy_set_header Connection \"Upgrade\";\r\n    proxy_set_header Host $host;\r\n }\r\n<\/pre>\n<div class=\"marked_note marked_note--warning\">WebSocket requests should only be proxied through HTTP. Otherwise, connecting to the conference will be impossible.<\/div>\n<p>At this point, the configuration of the Nginx proxy server is complete. To apply all the changes, you will need to restart the server. To do it, run the following command as the superuser:<\/p>\n<pre class=\"lang:default decode:true \"> sudo nginx -s reload\r\n<\/pre>\n<\/li>\n<\/ol>\n<h2>Firewall configuration<\/h2>\n<p>In addition to the protocols discussed previously (HTTP, HTTPS, and WebSocket), other protocols that use different ports may be needed for the correct work of all features available in TrueConf video conferencing:<\/p>\n<ul>\n<li><b>4307<\/b> \u2013 the main and only TCP port needed for transferring media data between TrueConf Server and TrueConf client applications<\/li>\n<li><b>554<\/b> \u2013 TCP port for working via RTSP protocol<\/li>\n<li><b>1720<\/b> \u2013 TCP port for establishing connection with H.323 devices<\/li>\n<li><b>52000\u201352499<\/b> \u2013 TCP ports that will be used for handshaking via H.323<\/li>\n<li><b>5060<\/b> \u2013 TCP or UDP port for initializing connection via SIP<\/li>\n<li><b>50000\u201351999<\/b> \u2013 UDP ports for transferring media streams via SIP\/H.323.<\/li>\n<\/ul>\n<div class=\"marked_note\">This list above includes only some of the required ports. To learn more about the ports used by TrueConf Server, check <a href=\"https:\/\/trueconf.com\/blog\/knowledge-base\/ports-trueconf-server-use.html\" target=\"_blank\" rel=\"noopener\">the corresponding guide<\/a>.  Also, note that many default ports can be changed to custom ones; please keep this in mind when configuring your firewall.<\/div>\n<p>In this case, HTTP\/HTTPS traffic routing via the NGINX web server will not be enough. You can use a firewall to configure forwarding for other ports. For example, it is possible to use the <a href=\"https:\/\/firewalld.org\/\" target=\"_blank\" rel=\"noopener\">firewalld<\/a> package.<\/p>\n<div class=\"marked_note\">To run the commands listed below, use the sudo program or enter the superuser mode by running the su command and entering the root password.<\/div>\n<ol>\n<li>At first, it is necessary to install the firewall:\n<pre class=\"lang:default decode:true \"> sudo apt install firewalld\r\n<\/pre>\n<\/li>\n<li>Next, allow requests to NGINX with these commands:\n<pre class=\"lang:default decode:true \"> sudo firewall-cmd --permanent --zone=\"public\" --add-service=http\r\n sudo firewall-cmd --permanent --zone=\"public\" --add-service=https\r\n<\/pre>\n<div>\n<p>Explanation of the parameters:<\/p>\n<ul style=\"list-style-type: none;\">\n<li><code>--permanent<\/code> \u2013 enables to add the setting <a href=\"https:\/\/firewalld.org\/documentation\/configuration\/runtime-versus-permanent.html\" target=\"_blank\" rel=\"noopener\">on a permanent basis<\/a> by saving it after the restart of the OS or firewall<\/li>\n<li><code>--zone=\"public\"<\/code> \u2013 selects the <a href=\"https:\/\/firewalld.org\/documentation\/zone\/\" target=\"_blank\" rel=\"noopener\">zone<\/a> to which the configuration will apply<\/li>\n<li><code>--add-service<\/code> \u2013 adds the <a href=\"https:\/\/firewalld.org\/documentation\/service\/\" target=\"_blank\" rel=\"noopener\">service<\/a> to the specified zone.<\/li>\n<\/ul>\n<\/div>\n<\/li>\n<li>Run the commands for forwarding TCP and UDP ports. These commands can be used for forwarding either a single port or a range of ports. We will show one command for each type: the first will forward the 554 port (for RTSP) and the second one will forward 50000-51999 port range (for SIP\/H.323):\n<pre class=\"lang:default decode:true \">sudo firewall-cmd --permanent --zone=\"public\" --add-forward-port=port=554:proto=tcp:toport=554:toaddr=192.168.10.1\r\nsudo firewall-cmd --permanent --zone=\"public\" --add-forward-port=port=50000-51999:proto=udp:toport=50000-51999:toaddr=192.168.10.1\r\n<\/pre>\n<div class=\"marked_note\">Similar commands can be used to forward <a href=\"https:\/\/trueconf.com\/blog\/knowledge-base\/ports-trueconf-server-use.html\" target=\"_blank\" rel=\"noopener\">other required ports<\/a><\/div>\n<div>\n<p>Explanation of the parameters:<\/p>\n<ul>\n<li><code>--add-forward-port<\/code> \u2014 enables to forward a port from one machine to another<\/li>\n<li><code>port<\/code> \u2013 specifies the port or a range of ports that will be forwarded<\/li>\n<li><code>proto<\/code> \u2013 specifies the protocol that will be used to transfer data via a port<\/li>\n<li><code>toport<\/code> \u2013 specifies the target port<\/li>\n<li><code>toaddr<\/code> \u2013 specifies the address of the machine to which the initial port will be forwarded.<\/li>\n<\/ul>\n<\/div>\n<\/li>\n<li>Run the commands that will substitute the address of the proxied machine (where TrueConf Server is installed) for the address of the proxy server. In this way, we will route the inbound and outbound traffic via the proxy by hiding the real IP of the video conferencing server. The list of ports for TCP and UDP protocols should be configured separately, for example:\n<pre class=\"lang:default decode:true \"> sudo firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -p tcp -m multiport --dports 4307,554,1720,5060,52000:52499 -j SNAT --to-source 192.168.10.2\r\n sudo firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -p udp -m multiport --dports 5060,50000:51999 -j SNAT --to-source 192.168.10.2\r\n<\/pre>\n<div>\n<p>Explanation of the parameters:<\/p>\n<ul>\n<li><code>--direct<\/code> \u2013 enables <a href=\"https:\/\/firewalld.org\/documentation\/direct\/\" target=\"_blank\" rel=\"noopener\">direct interface<\/a> allowing fine tuning (this is the syntax of the iptables package)<\/li>\n<li><code>--add-rule<\/code> \u2013 adds an iptables rule<\/li>\n<li><code>ipv4<\/code> \u2013 <a href=\"https:\/\/firewalld.org\/documentation\/direct\/options.html#chain\" target=\"_blank\" rel=\"noopener\">indicates<\/a> that the configuration is made for IPv4 traffic<\/li>\n<li><code>nat<\/code> \u2013 enables the NAT <a href=\"https:\/\/www.frozentux.net\/iptables-tutorial\/iptables-tutorial.html#NATTABLE\" target=\"_blank\" rel=\"noopener\">table<\/a><\/li>\n<li><code>POSTROUTING<\/code> &#8211; enables the <a href=\"https:\/\/www.frozentux.net\/iptables-tutorial\/iptables-tutorial.html#TRAVERSINGGENERAL\" target=\"_blank\" rel=\"noopener\">POSTROUTING<\/a> <a href=\"https:\/\/www.frozentux.net\/iptables-tutorial\/iptables-tutorial.html#IPFILTERGENERALTERMS\" target=\"_blank\" rel=\"noopener\">chain<\/a><\/li>\n<li><code>0<\/code> \u2013 the priority of the specified rule (0 is the highest priority)<\/li>\n<li><code>-p tcp<\/code> &#8211; <a href=\"https:\/\/www.frozentux.net\/iptables-tutorial\/iptables-tutorial.html#GENERICMATCHES\" target=\"_blank\" rel=\"noopener\">selects<\/a> TCP network protocol<\/li>\n<li><code>-p udp<\/code> \u2013 <a href=\"https:\/\/www.frozentux.net\/iptables-tutorial\/iptables-tutorial.html#GENERICMATCHES\" target=\"_blank\" rel=\"noopener\">selects<\/a> UDP network protocol<\/li>\n<li><code>-m multiport<\/code> \u2013 applies the rule to <a href=\"https:\/\/www.frozentux.net\/iptables-tutorial\/iptables-tutorial.html#MULTIPORTMATCH\" target=\"_blank\" rel=\"noopener\">multiple ports<\/a><\/li>\n<li><code>--dports<\/code> \u2013 the <a href=\"https:\/\/www.frozentux.net\/iptables-tutorial\/iptables-tutorial.html#IMPLICITMATCHES\" target=\"_blank\" rel=\"noopener\">list of ports<\/a> to which the rule will apply<\/li>\n<li><code>-j SNAT<\/code> &#8211; selects the <a href=\"https:\/\/www.frozentux.net\/iptables-tutorial\/iptables-tutorial.html#SNATTARGET\" target=\"_blank\" rel=\"noopener\">action<\/a> that will be performed if the packet matches the specified rule<\/li>\n<li><code>--to-source 192.168.10.2<\/code> \u2013 <a href=\"https:\/\/www.frozentux.net\/iptables-tutorial\/iptables-tutorial.html#SNATTARGET\" target=\"_blank\" rel=\"noopener\">specifies<\/a> the IP address that will be used to replace the initial one (in our case, it is the proxy IP address)<\/li>\n<\/ul>\n<\/div>\n<\/li>\n<\/ol>\n<h2>Configuration test<\/h2>\n<p>When the configuration is completed, restart firewalld to save changes:<\/p>\n<pre class=\"lang:default decode:true \"> sudo firewall-cmd --reload\r\n<\/pre>\n<p>Next, check if the settings have been applied. To do it, run the command identical to the one you used for port forwarding. You only have to replace <code>--add-forward-port<\/code> with <code>-\u2013query-forward-port<\/code>. For example, to check if the <b>554<\/b> port has been forwarded, run this command:<\/p>\n<pre class=\"lang:default decode:true \"> sudo firewall-cmd --permanent --zone=\"public\" --query-forward-port=port=554:proto=udp:toport=554:toaddr=192.168.10.1\r\n<\/pre>\n<p>If the word <code>no<\/code> is displayed in the console, the port has not been forwarded. This problem may occur because you did not include the <code>--permanent<\/code> key in the corresponding command. Re-run this command and make sure that this key is included.<br \/>\nIf the word <code>yes<\/code> is displayed in the console, the port has been successfully forwarded to the machine with TrueConf Server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The TrueConf Server messenger provides chat and video communication within a corporate network. If the server needs to be accessible from outside the network (from the internet), web services are often placed behind a reverse proxy for security reasons. A reverse proxy is a dedicated node (service) in the network infrastructure that is configured to [&hellip;]<\/p>\n","protected":false},"author":65,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[260],"tags":[186],"class_list":["post-22514","post","type-post","status-publish","format-standard","hentry","category-knowledge-base","tag-administration","wpautop"],"_links":{"self":[{"href":"https:\/\/trueconf.com/blog\/wp-json\/wp\/v2\/posts\/22514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trueconf.com/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trueconf.com/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trueconf.com/blog\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/trueconf.com/blog\/wp-json\/wp\/v2\/comments?post=22514"}],"version-history":[{"count":21,"href":"https:\/\/trueconf.com/blog\/wp-json\/wp\/v2\/posts\/22514\/revisions"}],"predecessor-version":[{"id":44074,"href":"https:\/\/trueconf.com/blog\/wp-json\/wp\/v2\/posts\/22514\/revisions\/44074"}],"wp:attachment":[{"href":"https:\/\/trueconf.com/blog\/wp-json\/wp\/v2\/media?parent=22514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trueconf.com/blog\/wp-json\/wp\/v2\/categories?post=22514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trueconf.com/blog\/wp-json\/wp\/v2\/tags?post=22514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}