Use your own Apache Web Server to run NoMachine sessions on the web
For NoMachine servers v. 7, please use https://www.nomachine.com/DT11R00189
For NoMachine servers v. 6, refer to: www.nomachine.com/DT03O00128
For Cloud Servers v. 5 and 4, follow instead instructions below.
The Cloud Server v. 5 and 4 comes with a small apache server (nxhtd) already configured to serve the web player application in charge of deploying NoMachine sessions on the web: no further manual configurations are necessary, just install the Cloud Server.
In some cases, administrators may need to use their own Apache web server, for example because their environment settings require to use additional modules not compiled in the NoMachine HTTP server.
This article provides instructions for configuring the alternative Apache web server to server the web player application, and for configuring the Cloud Server to let the web player work with a different web server.
Basic skills about Apache installation and configuration are requested.
Pre-requisites for the Apache Web Server
The following modules must be loaded in the web server:
autoindex
filter
deflate
mime
setenvif
status
actions
alias
expires
ssl
rewrite
cgid
Depending on the Linux sytem, the way to add and load these modules can be different and you should refer to the official documentation of your web server.
For example on Ubuntu 15.04 and 14.04 with Apache 2.4.10 run from a console and as privileged user:
a2enmod ssl
Note that on some distributions or OS versions some of the modules listed above may be already loaded by default. In this case, when trying to add them, you will get a message similar to:
a2enmod alias
Module alias already enabled
Apache provide a command to list all the modules already loaded. For example on Ubuntu 15.04 and 14.04 with Apache 2.4.10 run from a console:
apache2ctl -t -D DUMP_MODULES
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
[...]
Configure the Cloud Server for using an alternative Apache web server
Instructions below assume that the Apache version is 2.4.
The configuration files includes:
- /usr/NX/etc/cloud.cfg where username and group of the web server user is set.
- /usr/NX/etc/cloud.inc which is included in the web server configuration file.
IMPORTANT
Note that the cloud.inc include file is prepared for Apache 2.4. If you need to use a previous version of Apache, consider that the cloud.inc file needs to be updated to be compliant with the configuration of older Apache versions. Please refer to the official Apache documentation:
Step 1 - Modify the /usr/NX/etc/cloud.inc file
1.a) Modify this line:
TypesConfig etc/mime.types
to point to the full path:
TypesConfig /usr/NX/etc/mime.types
1.b) Add this directive:
<Directory "/usr/NX/share/htdocs">
Options +Indexes +FollowSymLinks +ExecCGI
AllowOverride None
Require all granted
</Directory>
1.c) Modify this directive :
<Directory "/usr/NX/">
AllowOverride None
Options None
</Directory>
to have:
<Directory "/usr/NX/">
AllowOverride None
Options None
Require all granted
</Directory>
1.d) Change port for HTTPS, if required
The cloud.inc file specifies port 4443 for HTTPS, modify all its occurrences to fit the port of your web server, if necessary. No changes are requested for the HTTP port.
Step 2 - Include the cloud.inc file in your web server configuration
If you are using the apache web server, the configuration file is usually the httpd.conf file. You can update it by adding the following directive before the "Global Environment" section:
Include <path to installation directory>/etc/cloud.inc
Step 3 - Restart your web server
Step 4 - Set user and group in the cloud server (webplayer) configuration
Edit the /usr/NX/etc/cloud.cfg file and update values set for the following keys to fit your web server:
ApacheUname
ApacheGname
For example if your web server is running as user www-data and group www-data, set:
ApacheUname www-data
ApacheGname www-data
Step 5 - Update the Cloud Server (webplayer) configuration
Run the update procedure to update the Cloud Server (webplayer) accordingly to the new configuration settings:
$ sudo /usr/NX/scripts/setup/nxwebplayer --update
This will change ownership and group of the web player files according to the value set in the ApacheUname and ApacheGname keys in the cloud.cfg file.
Step 6 - Stop the NoMachine HTTP server
Run from a console:
$ sudo /usr/NX/bin/nxserver --stop nxhtd
Step 7 - Disable the starting of the NoMachine HTTP server
Edit the server configuration file, namely /usr/NX/etc/server.cfg and remove HTTP from the ClientConnectionMethods key. it should look like:
ClientConnectionMethods NX,SSH
You are now ready to serve the NoMachine session on the web trough your own web server.
Point the browser to:
https://<ip>:<port>/nxwebplayer
to reach the application.
Important
If the Apache configuration include this directive:
<VirtualHost *:80>
when users connect to https://<ip>:<port> or https://<ip>, they will se the Apache index listing all web applications available. To forbid the directory listing, remove the <VirtualHost *:80> directive from the Apache configuration.
