• About us
    • Joomla Home
    • What is Joomla?
    • Benefits & Features
    • Project & Leadership
    • Trademark & Licensing
    • The Joomla Foundation
    • Support us
    • Contribute
    • Sponsor
    • Partner
    • Shop
    • Downloads
    • Extensions
    • Languages
    • Get a free site
    • Get a domain
    • User Guide
    • Training
    • Certification
    • Site Showcase
    • Announcements
    • Blogs
    • Magazine
    • Community Portal
    • Events
    • User Groups
    • Forum
    • Service Providers Directory
    • Volunteers Portal
    • Vulnerable Extensions List
    • What is Joomla Academy?
    • What is Google Summer of Code (GSoc)
    • Joomla License FAQs
    • Developer Network
    • Developer Manual
    • Security Centre
    • Issue Tracker
    • GitHub
    • API Documentation
    • Joomla! Framework
Joomla! User Documentation
Download
Launch
  • User Guide / Explanations
  • Tutorials
  • How-to Guides
  • Help pages / References
  • Contributors
  • Getting Started
    • Introduction to Joomla!
    • Joomla Core Features
    • Hosting Setup
    • Installing Joomla
    • Logging in to Joomla
    • Articles and categories
    • Adding a Category
    • Adding an Article
    • Adding a Menu Item
    • Adding a Module
    • Keyboard Shortcuts
  1. You are here:  
  2. Home
  3. Site Building
  4. Hosting Notes

Hosting Notes

Apache PHP Handlers

Notes

To determine which method your web server is using to handle php files use the Administrator / System / System Information links and select the PHP Information tab. Search the page for Server API. The common ways for an Apache web server to handle PHP files include the following:

DSO (mod_php)

  • Advantage: one of the fastest handlers available.
  • Disadvantage: only works with a single version of PHP; files saved by php scripts are owned by the Apache user except when used in conjunction with mod_ruid2.
  • To recognise: Server API - Apache 2.0 Handler

CGI/FastCGI

  • Advantage: scripts run as the domain or subdomain user, very fast handler.
  • Disadvantage: slower than mod_php, cannot put PHP configuration changes in an .htaccess file.
  • To Recognise: Server API - CGI/FastCGI

FPM/FastCGI

  • Advantage: very fast, additional level of flexibility.
  • Disadvantage: uses more memory than most of the others, cannot put PHP configuration changes in an .htaccess file.
  • To Recognise: Server API - FPM/FastCGI

LSAPI (mod_lsapi)

LiteSpeed Server Application Programming Interface is a PHP handler designed specifically for LiteSpeed Web Server, emphasising high performance and efficiency.

  • Advantages:
    • Provides support for caching.
    • It is the most performant handler with a low memory footprint.
    • No configuration is required.
    • It can work with multiple PHP versions in a single setup.
    • It supports PHP configuration directives through .htaccess files.
    • Secure because scripts execute as the domain owner.
  • Disadvantages:
    • It does not make available all LSAPI capabilities.
  • To Recognise: Server API - ?

On a local laptop or desktop computer you can use mod_php but you may need to set the Apache user to your own username and point the document root to a location in your own file space. Otherwise you will have file and folder permissions problems.

On a hosting service you need to use one of the FastCGI alternatives or LSAPI. Hosting services may give you a choice.

Hosting Notes

A collection of practical background information on hosting a Joomla website – ranging from basic technical topics such as file permissions and web servers to issues relating to domain management.

  • UNIX File Permissions – This article explains how UNIX file permissions (Owner/Group/Other with read/write/execute, expressed numerically, e.g. 644/755) work and how they should be set specifically for Joomla installations on web servers – particularly in relation to topics such as web installers, write permissions for directories/files and security considerations (for example, regarding configuration.php) – should be set correctly.
  • Windows File Permissions – This article explains the differences between Windows permission models (Apache/Win32 vs. IIS, ACLs such as Full Control, Modify, Read & Execute) and the ‘Everyone’ permissions that are open by default, and shows how these can be roughly translated into the numerical permissions familiar from UNIX (e.g. 644, 755) in order to run Joomla websites securely on Windows.
  • Multiple Domains and Web Sites in a single Joomla! installation – Using the example of a confectionery company with two brands, this article demonstrates how a single Joomla installation can be used to run several websites simultaneously, each with a different domain and design, by automatically redirecting visitors to the appropriate page depending on the address they enter.
  • Types of Domains Explained – This displays the difference between a subdomain (e.g. forum.mywebsite.de), a parked domain (several addresses that all point to the same website) and an additional domain (a completely separate second website within the same hosting account).
  • Nginx – This article explains, step by step, how to install the lightweight Nginx web server (instead of the widely used Apache) and configure it to run a Joomla website.
  • Apache PHP Handlers – are the tools within the Apache web server that actually execute the PHP files of a Joomla site and convert them into a finished web page – although there are differences in speed, security and configurability depending on the handler.
  • Optional Technical Requirements – The page lists, in a table, additional, non-essential server components (e.g. for images, databases, caching or encryption) which Joomla only requires for certain additional functions, but which are not necessary for normal operation.

Multiple Domains and Web Sites in a single Joomla! installation

Note: This article was last updated in 2012!

Although it's a best-practice to give every Website its own domain, Joomla! installation and database there can be special conditions in which a multi-site solution under a single Joomla! install is warranted.

An Example Application

A small business, 'Johnson Candies', has two separate but related brands: Red Candy and Yellow Candy. They require a single Joomla!-based Website where both candy types are visible, each with its own home page on the Joomla! site which corresponds to the domains www.redjohnsoncandy.com and www.yellowjohnsoncandy.com.

Additionally, each brand and site requires its own design: a yellow template for one; a red template, for the other.

Benefits

By including both brands in a single Joomla! web installation, Johnson Candies is able to save editing time (only one login), share articles and data across both brands (or sites) and use a single feature, such as a Contact Us form, for both brands.

Implementation Procedure

Prepare Your Domains

Use a single domain for your hosting account, as normal. Create the required add-on domains in the control panel of your hosting account. For the purpose of this tutorial, we will use www.redjohnsoncandy.com in addition to the base www.yellowjohnsoncandy.com domain name.

Install and Setup Joomla!

Install and setup Joomla! normally. Then develop articles, menus and modules for each site.

Create Templates

Next develop and install the necessary templates - one for each site that you wish to have. In the above example, you would create a template for red candy named Red Template and a template for yellow candy named Yellow Template. Once the templates are installed, assign them to the relevant menu items, using the Joomla! template manager in the Joomla! Administrator area.

Add a Redirect

Option #1: Create an .htaccess (Apache) redirect

Note Enable SEF URLs in Joomla! First

One option is to use .htaccess (Apache) to redirect inquiries to a given domain to a specific Joomla! page.

Our goal is to redirect any inquries to the Red Candy domain name to a given page on the Joomla! site. In this example, we redirect any inquiries to www.redjohnsoncandy.com to a category-blog page. You would have previously assigned the 'red cand y' template to this menu item, to create the illusion of a separate site.

#The following rule works, but it changes which domain name displays.
RewriteCond %{HTTP_HOST} ^(www\.)?redjohnsoncandy\.com$
RewriteRule (.*) http://www.yellowjohnsoncandy.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=12 [R=301,L]

Well, that works - but you can see the drawback immediately. Although the user is successfully viewing the Red Candy site, they will still see the Yellow Candy domain name. Unfortunately, if you are using both .htaccess and domain-parking (technically a redirect) - this is necessary in order to avoid creating a LOOP.

Option #2: Create a PHP Header Redirect

This solution has the benefit of keeping the illusion of separate domains/web sites apparent to the visitor. Instead of using .htaccess (Apache) for our redirect, we use one of the templates on the site.

In this example, the base domain is www.redjohnsoncandy.com. You have created a template for that area named Red Template. The trick is to open 'Red Template's' index.php file and add the following as the very first lines of the install's primary index.php.

<?php
$domain = $_SERVER["HTTP_HOST"];
$uri = $_SERVER["REQUEST_URI"];
$url = $domain . $uri;

if (($url == "redjohnsoncandy.com/") ||
   ($url == "www.redjohnsoncandy.com/")) {
   header("Status: 301 Moved Permanently");
   header("Location: http://www.redjohnsoncandy.com/index.php?option=com_content&view=category&layout=blog&id=3&Itemid=12");
}
?>

Here's the benefit: The visitor will now be redirected to the appropriate Red Site page, that has the Red Template assigned to it only in the case where they have arrived at the 'red site' domain name. Otherwise, the conditional PHP rule is ignored, and the Yellow Site loads.

It is important to remember to request also de URI (url that follows the pure domain) so that you can make redirections to the same domain. When the URI is invisible in the url the variable becomes a "/" sign. That is why you have to compare your pure url with a "/" sign at the end. This way you´ll be able to make 301 redirects in the same domain. Otherwise you´ll create an infinite loop in the redirection process.

Option #3: Create a PHP Header Redirect, for multiple domains with specific domain redirects for custom templates

Solution for single webspace, with different domains, one Joomla install and depending on the user landing domain, redirects to a different default page. Paste following PHP code as the very first thing in the install's primary index.php file. To assign another domain, just copy/past the "if" function and edit it with the values of the other domain in the same fashion. Further to setup the template views, you will have to assign different module item/link alias and setup template views within the Joomla! template manager. The alias setting is needed when you use SEF settings.

<?php
$domain = $_SERVER["SERVER_NAME"];
$requri = $_SERVER['REQUEST_URI'];
if (($domain == "www.example.de" && $requri == "/" ||
   $domain == "example.de"))  {
   header("Status: 301 Moved Permanently");
   header("Location: http://www.example.de/index.php?option=com_content&view=article&id=6");
}
?>

Nginx

Nginx is a lightweight Web server that powers about 33% of Web servers across all domains. Unless you have specific requirements that demand a heavy Web server like Apache, you are much better off using Nginx.

Below are instructions on how to get Joomla! running with PHP FastCGI Example.

Install Nginx

For Ubuntu, run aptitude install Nginx. For other distributions, run the corresponding package manager or see the Nginx Install page.

Install PHP FastCGI

For Ubuntu, read PHP FastCGI Example.

For Gentoo, PHP will run as a FastCGI service (FPM), so the Nginx server will run PHP as a separate process:

# echo "dev-lang/php gd gd2 curl simplexml tokenizer dom tidy sqlite xml fpm cgi" >> /etc/portage/package.use
# emerge php

The default settings of PHP-FPM are good for most servers. For special configurations, visit the PHP FPM site.

Configure Nginx

Nginx configuration files reside in:

  • /etc/nginx/sites-available/ on Ubuntu (for sites running on that Nginx instance)
  • /etc/nginx/nginx.conf on Gentoo and Raspbian (Debian optimized for Raspberry Pi)

Here is an sample Nginx configuration file, joomla.conf, that you can reuse over all your Nginx enabled-sites.

server {
  listen 80;
    server_name YOUR_DOMAIN;
    server_name_in_redirect off;

    access_log /var/log/nginx/localhost.access_log;
    error_log /var/log/nginx/localhost.error_log info;

    root PATH_ON_SERVER;
    index index.php index.html index.htm default.html default.htm;
    # Support Clean (aka Search Engine Friendly) URLs
    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    # add global x-content-type-options header
    add_header X-Content-Type-Options nosniff;

    # deny running scripts inside writable directories
    location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
        return 403;
        error_page 403 /403_error.html;
    }

    location ~ \.php$ {
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include /etc/nginx/fastcgi.conf;
    }

    # caching of files
    location ~* \.(ico|pdf|flv)$ {
        expires 1y;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
        expires 14d;
    }

}

Pay attention to a few things:

  1. The parameter fastcgi_pass is set to 127.0.0.1:9000, corresponding to the port that FPM is configured to listen to. This means you can run the PHP processes on separate servers. On Gentoo, you can find this configuration in the /etc/php/fpm-php5.3/php-fpm.conf/ file.
  2. Don't forget to replace YOUR_DOMAIN & PATH_ON_SERVER above depending on your domain and the path of Joomla on your server.

GZip Support

If you need GZip compression support, add the following section to the http section of the main Nginx configuration file:

gzip on;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain application/xhtml+xml text/css application/xml application/xml+rss text/javascript application/javascript application/x-javascript
gzip_proxied any;
gzip_disable "MSIE [1-6]\.";

Sources

  • Nginx in Gentoo
  • Nginx for Windows
  • Nginx in Ubuntu
  • Nginx in Debian
  • PHP-FPM installation and configuration
  • Compression and Decompression
  • Creating NGINX Rewrite Rules
  • How Nginx processes a request

Optional Technical Requirements

This page lists optional technical requirements which are not required to install and run Joomla! but are required for some internal APIs. The list was created for Joomla 4.

Item Description
Application  
JApplicationDaemon Requires PHP's ext/pcntl and ext/posix
Archive  
BZ2 Requires PHP's ext/bz2
GZip Requires PHP's ext/zlib
Zip Requires PHP's ext/zip or ext/zlib
Cache  
APC Requires PHP's ext/apc on PHP 5.3 or 5.4, ext/apcu on PHP 5.5 or 5.6, unsupported on PHP 7.x (Note: THIS NEED TO BE CHECKED)
APCu Requires PHP's ext/apcu on PHP 5.3+
CacheLite Requires the PEAR Cache_Lite package (tested on 1.7.16, will work with 1.8)
Memcache Requires PHP's ext/memcache and a Memcache server (Note: The Memcache extension is not compatible with PHP 7.x)
Memcached Requires PHP's ext/memcached and a Memcached server
Redis Requires PHP's ext/redis and a Redis server
Wincache Requires PHP's ext/wincache (Windows only)
XCache Requires PHP's ext/xcache
Client adapters  
LDAP Requires PHP's ext/ldap
HTTP/Curl Requires PHP's ext/curl
HTTP/Socket Requires PHP's fsockopen() function be enabled
HTTP/Stream Requires PHP's fopen() function and allow_url_fopen enabled
Cryptography  
JCrypt Requires PHP's ext/mcrypt for all ciphers except the SodiumCipher which requires ext/sodium
JKeychain Requires PHP's ext/openssl
Database  
Microsoft SQL Azure Requires PHP's ext/sqlsrv (the PHP 5.x extension only supports Windows, a Linux compatible version of the extension is available for PHP 7.x)
Microsoft SQL Server Requires PHP's ext/sqlsrv (the PHP 5.x extension only supports Windows, a Linux compatible version of the extension is available for PHP 7.x)
MySQL Requires PHP's ext/mysql (unsupported on PHP 7.x)
MySQLi Requires PHP's ext/mysqli
Oracle Requires PHP's ext/pdo with Oracle support (available for 3PD only; the CMS won't run with it)
PDO MySQL Requires PHP's ext/pdo with MySQL support
PostgreSQL Requires PHP's ext/pgsql
SQLite Requires PHP's ext/pdo with SQLite support (available for 3PD only; the CMS won't run with it)
Image  
  Requires PHP's ext/gd
  Requires PHP's ext/fileinfo
Session  
APC Requires PHP's ext/apc on PHP 5.3 or 5.4, ext/apcu on PHP 5.5 or 5.6, unsupported on PHP 7.x (Note: THIS NEEDS TO BE CHECKED)
Memcache Requires PHP's ext/memcache and a Memcache server (Note: The Memcache extension is not compatible with PHP 7.x)
Memcached Requires PHP's ext/memcached and a Memcached server
Wincache Requires PHP's ext/wincache (Windows only)
XCache Requires PHP's ext/xcache
OPTIONAL IMPROVEMENTS  
String  
mbstring Enable PHP's ext/mbstring for the phputf8 library to use native functions
  1. Sub-Domains, Parked Domains and Add-On Domains
  2. UNIX File Permissions
  3. Windows File Permissions
  1. You are here:  
  2. Home
  3. Site Building
  4. Hosting Notes

  • Joomla! on Facebook
  • Joomla! on X
  • Joomla! on Bluesky
  • Joomla! on Threads
  • Joomla! on YouTube
  • Joomla! on LinkedIn
  • Joomla! on Pinterest
  • Joomla! on Instagram
  • Joomla! on GitHub
  • Home
  • About
  • Community
  • Forum
  • Extensions
  • Services
  • User Guide
  • Developer
  • Shop
  • Accessibility Statement
  • Privacy Policy
  • Cookie Policy
  • Sponsor Joomla! with $5
  • Help Translate
  • Report an Issue
  • Log in
 A Digital Public Good.

© 2005 - 2026 Open Source Matters, Inc. All Rights Reserved.

Rochen
Joomla! Hosting by Rochen
We have detected that you are using an ad blocker. The Joomla! Project relies on revenue from these advertisements so please consider disabling the ad blocker for this domain.