NATS4 Apache Configuration
Join Link Issues
The following information can be used for your Apache Configuration files if you are having problems with your NATS join links.
Executing PHP Pages
Your server needs to parse both your tour and members area pages for PHP, so that you can use our NATS tracking and join links correctly. If you're currently using html pages, you can tell Apache to parse them for PHP as well. Find the following line in your Apache httpd.conf:
AddType application/x-httpd-php .php
Add the following extensions to the end of the line above:
.php .php3 .html .htm
You might be using a different named PHP handler than "application/x-httpd-php". If so, look for the line that begins with AddType, and includes .php, and modify that.
If your linkcodes go to your NATS install instead of your site, ensure you have the following two lines in your Apache configuration:
<Directory /home/www> Options FollowSymLinks AllowOverride All </Directory>
The lines should be in a global virtual host configuration. For example:
<VirtualHost *:80> ServerAdmin email@example.com DocumentRoot /home/www ServerName site.com ServerAlias *.site.com CustomLog /dev/null common <Directory /home/www> Options FollowSymLinks AllowOverride All </Directory> </VirtualHost>
Custom PHP Handlers
(As of NATS version 220.127.116.11)
NATS assumes that your Apache PHP handler is named "application/x-httpd-php", and makes that assumption when setting up your track links. If your PHP handler is named differently, you can let NATS know your PHP handler by setting the $nats-php-handler Apache variable in your virtual host.
Note: The Define Directive was first made available as a core directive in apache 2.4. So if you are using apache 2.2 than you will need to install the Define module before being able to use this directive.
Add this to your NATS virtual host:
Define nats-php-handler [handler]
Where [handler] is the name of the handler you wish to use. For example:
Define nats-php-handler application/x-httpd-php56
If you're using PHP-FPM, you can also use this variable to set the handler variable by giving the full proxy handler path, as you would when setting the php AddType. For example:
Define nats-php-handler "proxy:unix:/run/php/php7.2-fpm.sock|fcgi://localhost"
Keep in mind
- You'll still need to set the handler for normal .php files using AddType, as normal. This variable simply allows NATS to know which handler to use for custom shortened links.
- This change will allow the NATS .htaccess file to be able to use your handler if you're using php-fpm, but there are other concerns to consider when using php-fpm as well -- this variable will not resolve all of them. If looking to setup using php-fpm instead of Apache'd mod_php module, please submit a support ticket.
- Apache defined variables are globally scoped, which means if you set a variable in your virtualhost, it can affect other virtualhosts as well.