



How to configure nxhtd to listen on specific addresses and/or ports
This article is superseded by:
https://www.nomachine.com/AR12Q01065
which explain how to change the port for HTTP and/or HTTPS connections.
NoMachine provides a minimal Apache web server, nxhtd, which is pre-configured to serve sessions on the web.
As it's by default with Apache, nxhtd is listening on all interfaces:
"When httpd starts, it binds to some port and address on the local machine and waits for incoming requests. By default, it listens to all addresses on the machine. However, it may need to be told to listen on specific ports, or only on selected addresses, or a combination of both." (ref. https://httpd.apache.org/docs/2.4/bind.html)
Instructions to configure nxhtd to listen on specific interface
Listen directives are set in the htd.cfg file:
/usr/NX/etc/htd.cfg on Linux
/Applications/NoMachine.app/Contents/Frameworks/etc/htd.cfg on Mac
<installation directory>/etc/htd.cfg on Windows
and by default are:
Listen 0.0.0.0:4080
Listen 0.0.0.0:4443 https
To change the listen directive in order to specify the interface(s) on which nxhtd should listen:
1) Stop nxhtd
On Linux and Mac, execute in a terminal:
sudo /etc/NX/nxserver --stop nxhtd
On Windows, launch a CMD console as administrator and move to the 'bin' directory under the NoMachine installation. Then execute:
nxserver --stop nxhtd
2) Edit htd.cfg and comment out the default directives:
# Listen 0.0.0.0:4080
# Listen 0.0.0.0:4443 https
3) Add the proper directives to specify one or more interfaces, for example:
Listen 192.168.1.2:4080
Listen 192.168.1.2:4443 https
In the example above, nxhtd will listen only on one interface, IP 192.168.1.2 [ports: 4080 and 4443]. With these directives, access to the NoMachine web player from 127.0.0.1 is blocked.
Specify as many directives as needed. For example, if access from 127.0.0.1 should be allowed, add:
Listen 127.0.0.1:4080
Listen 127.0.0.1:4443 https
4) Start nxhtd
On Linux and Mac, execute in a terminal:
sudo /etc/NX/nxserver --start nxhtd
On Windows, launch a CMD console as administrator and move to the 'bin' directory under the NoMachine installation. Then execute:
nxserver --start nxhtd