NoMachine Support

Your questions answered

Knowledge Base

Searching in: Articles & FAQs
Filter the search results
Applies to:
Last update:
Searching in: Articles & FAQs
ID: AR12Q01065
Applies to: NoMachine Server
Added on: 2019-12-09
Last update: 2019-12-27
How to change default ports for nxhtd

The NoMachine web server, nxhtd, accepts by default connections on port 4080 (HTTP) and 4443 (HTTPS).

Administrators may change the listen ports via server's UI:
1) Click on the !M icon in the system tray to open the menu.
2) Click on Show the service status and finally on Server preferences.
3) in the Services panel, select HTTP or HTTPS and click on 'Configure' to access the panel for changing ports. Authenticating with a privileged account is requested.
4) Restart the nxhtd service to make changes effective. This will drop current sessions via web if any.


As an alternative, administrators can configure nxhtd manually.

 Edit manually the nxhtd configuration file, htd.cfg.

Let's assume that you want to change the default ports from 4080/4443 to 80/443, for example on Linux or Mac.

STEP 1 - Shutdown nxhtd

sudo /etc/NX/nxserver --stop nxhtd

STEP 2 - Edit htd.cfg and

replace:
Listen 0.0.0.0:4080
Listen 0.0.0.0:4443 https

with:
Listen 0.0.0.0:80
Listen 0.0.0.0:443 https

and:
<VirtualHost 0.0.0.0:4443>

with:
<VirtualHost 0.0.0.0:443>

and:
<VirtualHost _default_:*>
RewriteEngine on

ReWriteCond %SERVER_PORT !^4443$
RewriteRule ^/(.*) https://%SERVER_ADDR:4443/nxwebplayer [R,L]
</VirtualHost>

with:
<VirtualHost _default_:*>
RewriteEngine on

ReWriteCond %SERVER_PORT !^443$
RewriteRule ^/(.*) https://%SERVER_ADDR:443/nxwebplayer [R,L]
</VirtualHost>
 

STEP 3 -  start nxhtd

sudo /etc/NX/nxserver --start nxhtd
 


Other references
- How to synchronize the NoMachine HA failover cluster when ports for nxhtd have been changed
https://www.nomachine.com/AR06P00984

- The NoMachine Server UI
https://www.nomachine.com/DT10O00155


- How to make the web player to connect NoMachine server on a port different than default 4000 (protocol NX)
https://www.nomachine.com/AR06N00888

- How to change the SSL Certificate for encrypting data traffic between the web server and browsers
https://www.nomachine.com/AR05P00980
https://www.nomachine.com/DT03O00127#3