Difference between revisions of "NATS4 Apache Configuration"

From TMM Wiki
Jump to navigationJump to search
Line 44: Line 44:
 
* 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.
 
* 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.
 
* 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. If you're running different versions of PHP and need different versions of NATS to use them for some reason, make sure to set nats-php-handler in each virtualhost, even if you're using the default php handler name.
+
* Apache defined variables are globally scoped, which means if you set a variable in your virtualhost, it can affect other virtualhosts as well. If you're running different versions of PHP and need different instances of NATS to use them for some reason, make sure to set nats-php-handler in each virtualhost, even if you're using the default php handler name.
  
 
=== FollowSymLinks ===
 
=== FollowSymLinks ===

Revision as of 17:51, 24 January 2019

NATS 4
NATS Setup
Post-Installation Steps
Apache Configuration
MySQL Settings
Creating Admin Accounts
Multiple Server Setup
Using Memcached for Caching
File Upload Setup
Link Domain
HTTPS Setup
NATS4 Files and Directories
NATS4 Go Live Checklist
NATS3 to NATS4 Going Live Checklist
Moving NATS4
Members Admin
The Members Admin
View Member Details
Add Member
MySQL Auth
Mod Authn DB
Multisite Access
Member Logging
Member Password Retrieval
OpenID Connect
Mod Auth OpenIDC
ID Numbers

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.

Custom PHP Handlers

(As of NATS version 4.1.22.2)

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.

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. If you're running different versions of PHP and need different instances of NATS to use them for some reason, make sure to set nats-php-handler in each virtualhost, even if you're using the default php handler name.

FollowSymLinks

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 webmaster@site.com
        DocumentRoot /home/www
        ServerName site.com
        ServerAlias *.site.com
        CustomLog /dev/null common
        <Directory /home/www>
                Options FollowSymLinks
                AllowOverride All
        </Directory>
</VirtualHost>

See Also