• 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
    • Documentation
    • Training
    • Certification
    • Site Showcase
    • Announcements
    • Blogs
    • Magazine
    • Community Portal
    • Events
    • User Groups
    • Forum
    • Service Providers Directory
    • Volunteers Portal
    • Vulnerable Extensions List
    • Developer Network
    • Security Centre
    • Issue Tracker
    • GitHub
    • API Documentation
    • Joomla! Framework

Joomla!

Download
Launch
  • Joomla Documentation
  • User Manual
  • Jobs To Do
  • Contributors
  • Re-structure

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.

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

Sub-Domains, Parked Domains and Add-On Domains

Differences

This article is a basic outline of the differences between a Sub-Domains, Parked Domains, and Add-On Domains. Creation of each domain type on your selected hosting service may differ depending on what control control panel is offered. Each hosting service is different in what their hosting plans include, so all three options may not be available under your plan. Any questions about what options are available with your particular plan, or for help in setting up these options on your hosting plan should be directed to your hosts support Help/FAQ pages or to your hosts support team.

Here are some basic differences between the three:

Sub domain

  • Let's say you own domain site1.com.
  • You only own one domain or only wish to have a forum on one domain.
  • You decide to install a forum and want the forum installed in a directory called forum
  • You can create a sub-domain by adding the directory 'forum' as a sub-domain from your domain site1.com control panel.
  • Once the sub-domain forum is created, people can access your forum as either site1.com/forum or forum.site1.com

Parked Domain

  • You own multiple domains such as site1.com, site1.org and site2.net.
  • You want site1.com as the main domain for your website and you want people who type in site1.org or site2.net to go to the main site1.com website.
  • Using the domain control panel for site1, you can park additional domains
  • The multiple domain names you own will be parked and will point to the site1.com domain.
  • You will be unable to use a parked domains for separate websites unless you unpark them.
  • This is a good way if you own multiple domains such as site1.com, site1.org, site1.net to have all domains point to the same website domain

Add-On Domains

  • You own two domains site1.com and site2.org.
  • Your main domain is site1.org
  • You want to add your second domain site2.org to your hosting account
  • You want the two domains to be totally separate and independent websites.
  • From the domain site1.com control panel you can add the second domain
  • Each domain is accessed by a control panel that is common to both
  • When a person types site1.com in their browser they are taken to site1.com
  • When a person types site2.org in their browser they are taken to site2.org
  • Each domain shares your hosting plans resources
  1. UNIX File Permissions
  2. Windows File Permissions
  1. You are here:  
  2. Home
  3. Documentation
  4. User Guides
  5. Site Building
  6. Hosting Notes

  • Joomla! on Twitter
  • Joomla! on Facebook
  • Joomla! on YouTube
  • Joomla! on LinkedIn
  • Joomla! on Pinterest
  • Joomla! on Instagram
  • Joomla! on GitHub
  • Home
  • About
  • Community
  • Forum
  • Extensions
  • Services
  • Docs
  • Developer
  • Shop
  • Accessibility Statement
  • Privacy Policy
  • Cookie Policy
  • Sponsor Joomla! with $5
  • Help Translate
  • Report an Issue
  • Log in

© 2005 - 2025 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.