Instrumenting an NGINX Server Using Container-Assisted Injection
To RUM-enable a web site / web application on an NGINX web server, follow the steps below:
The substitution mechanism requires the ngx_http_sub_module for RUM-enabling a web site / web application on NGINX. This module is an extension and hence, may not be included in an NGINX build by default. Therefore, first check whether/not the NGINX build in use is built with this module. For that, run the following command on the NGINX web server host:
- If the output returned by this command does not include the ngx_http_sub_module, then it indicates that the NGINX web server in use has not been configured with the ngx_http_sub_module module. In this case, make sure that the NGINX build is first enabled with the with-http_sub_module configuration parameter, and then proceed to RUM-enable it.
When replacing, ensure the following:
- The <head> tag should begin with a single quote, as depicted by Figure 1.
- All single quotes within the head tag should be replaced by double quotes as indicated by Figure 1.
- The code block highlighted in Figure 1 is the one that you will have to insert in the nginx.conf file. Make sure that you replace the variable RUM_COLLECTOR_DOMAIN_NAME:PORT in the code block, with the fully qualified domain name of the RUM collector and its port. The rule represented by this code block looks for an exact <head> tag match. Optionally, you can use the <body> tag or <title> tag too .
- Finally, save the file and restart the NGINX server.