# DeviceAtlas Apache2 Module # Quick Start There are 3 important steps for the usage of the DeviceAtlas C API and Apache module. - Make the API & module - Install the shared libraries - Configure Apache (minimum supported: 2.0, recommended: 2.4 and onwards). Optional: - Enable the client side component ** Dependencies ** - Apache web server headers - Apr and Apr Utils (Apache Portable Runtime Library) (Example for Red Hat based operating systems, the needed package is httpd-devel (it will install related apr-devel and apr-util-devel packages), for Debian based ones, the name is apache2-threaded-dev (it will install related libapr1-dev and libaprutil1-dev packages). For ubuntu you can install package apache2-dev for apache headers and include files. If your Apache headers and/or Apr/Apr-util library and headers are located in custom locations you have to set those cmake environment variables : - APACHE_INCLUDE_DIR=&lt;path to apache/httpd headers folder&gt; - APR_INCLUDE_DIR=&lt;path to apr/apr-util headers folder&gt; - APR_LIBRARY=&lt;path to apr library&gt; For example : ```shell cmake <other environment variables> ... -DAPACHE_INCLUDE_DIR=/home/test/httpd/include -DAPR_INCLUDE_DIR=/home/test/apr/include -DAPR_LIBRARY=/home/test/apr/lib/libapr-1.so ``` 32/64bit: - This Apache module must be built according to Apache web server itself (If Apache is 64 bits compliant, the module has to be too...) ** Step 1 ** a) EXTRACT PACKAGE b) cmake . (or cmake -DCMAKE_SKIP_INSTALL_RPATH=1 if you do not wish to link the Apache module to the current package location) $ unzip deviceatlas-enterprise-c-{version}.zip $ cd deviceatlas-enterprise-c-{version} $ cmake . $ make $ make install ** Step 2 ** $ cp Apache-Mod $ make -f GNUMakefile Module directory in Ubuntu 9.04: /usr/lib/apache2/modules ** Step 3 ** Apache must be configured to load the DeviceAtlas module. The module is then configured in the Virtual Host. # Add to httpd.conf "LoadModule da_module /PATH/TO/MODULE/libmod_da.so" # Enable Module in virtual host <VirtualHost *:80> DA On # (Optional) # DAEnvironmentVars On (Device / Carrier properties set as environment variables # by default they are set as request headers) DAJsonFilePath /PATH/TO/JSON (If DeviceAtlas support) DACarrierApiFilePath /PATH/TO/DATA FILE (If Carrier Identification support) </VirtualHost> => For more information/options check the apache2/virtualhost.*.conf files ** Step 4 ** RESTART APACHE! NOTE: The Apache module prefixes all property names with "X-DeviceAtlas-" when setting the properties in the request headers. For example the property "mobileDevice" becomes a header called "X-DeviceAtlas-mobileDevice". A PHP sample application is available for a test inside the ExampleApp, you can copy those files to your DocumentRoot and try /index.php ** Common Errors ** When building Apache module if you see errors like ``` -- Could NOT find APACHE (missing: APACHE_INCLUDE_DIR) -- Could NOT find APR (missing: APR_INCLUDE_DIR) -- Could NOT find APR_UTIL (missing: APR_UTIL_INCLUDE_DIR) APACHE module requires APR and APACHE headers - not found ``` You might have wrong paths set for Apache headers and include files, please read Dependencies section for more details. ** Mod Proxy ** It is possible to use the module with the Apache builtin mod proxy module. Typical usage would be to have one server having the DeviceAtlas module proxying to one or more servers, the DeviceAtlas properties will be send as request headers to these. In an usual JSON setting and device clients reaching the servers, it is however not always possible to send all properties due to request headers size limits. It is then recommended to both set LimitRequestFieldSize to a higher value and using the DaIncludeHeader for each necessary property the servers need to process for the business logic to operate. ```shell ... DaIncludeHeader primaryHardwareType DaIncludeHeader vendor DaIncludeHeader model DaIncludeHeader devicePixelRatio ... ``` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _ Copyright (c) DeviceAtlas Limited 2023. All Rights Reserved. _ <!-- HTML+JS for document formatting when opened in browser --> <div class="btn-group" id="main-menu" style="float:right"><a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Menu<span class="caret"></span></a><ul class="dropdown-menu"><li><a href="README.html">Main</a></li><li><a href="README.DeviceApi.html">Device API Usage C</a></li><li><a href="README.ClientHints.html">Client Hints Support</a></li><li><a href="README.CarrierApi.html">Carrier Identification API</a></li><li><a href="README.Upgrade.html">Device API Upgrade</a></li><li><a href="README.Cpp.html">Device API C++</a></li><li><a href="README.Nginx.html">NGINX Module</a></li><li class="disabled"><a href="README.Apache2.html">Apache2 Module</a></li><li><a href="README.JsonConverter.html">Device Identification API C JSONConverter</a></li><li><a href="README.Go-DeviceApi.html">Device API Usage Go</a></li><li><a href="README.Go-Upgrade.html">Device API Upgrade Go</a></li><li><a href="https://docs.deviceatlas.com/apis/clientside/latest/README.ClientSide.html" target="_blank">Client-side component</a></li><li class="divider"></li><li><a href="./ApiDocs/index.html">C ApiDocs</a></li><li><a href="./ApiCppDocs/index.html">C ++ interface ApiDocs</a></li><li><a href="./Go-ApiDocs/carrier.html">Go ApiDocs Carrier</a></li><li><a href="./Go-ApiDocs/device.html">Go ApiDocs Device</a></li></ul></div>