How to install Joomla with Lighttpd on Ubuntu Linux

|

,

|

This article provides detailed steps on how to install Joomla, a popular content management system (CMS), with Lighttpd support on Ubuntu Linux. The process includes installing Lighttpd, a high-performance HTTP server, MariaDB, a database server, PHP 7.1, and setting up and configuring a Joomla database. Lastly, they also guide on polishing the server-side scripting, downloading…

This article describes the steps to install Joomla with Lighttpd support on Ubuntu Linux.

Lighttpd is a secure, fast, and flexible HTTP server with a smaller memory footprint than other webservers. In addition, its event-driven architecture is optimized for many parallel connections (keep-alive), which is essential for high-performance dynamic applications.

Joomla is a popular content management system (CMS) that allows developers to create dynamic and robust websites based on PHP. However, to run Joomla, you need an HTTP server, and Lighttpd is one of the most secure, fast, and flexible HTTP servers available.

It also has a smaller memory footprint than other webservers and is optimized for many parallel connections, essential for high-performance dynamic applications. Ubuntu Linux is a popular operating system widely used for web development.

Therefore, installing Joomla with Lighttpd support on Ubuntu Linux can provide a secure and optimized environment to create and manage your Joomla website.

How to install Joomla on Ubuntu Linux with Lighttpd support

As described above, Lighttpd is a secure, fast, and flexible HTTP server with a smaller memory footprint than other webservers.

Below is how to install Joomla with Lighttpd support on Ubuntu Linux.

Install Lighttpd

sudo apt install lighttpd

After installing Lighttpd, the commands below can be used to stop, start, and enable Lighttpd service always to start when the server boots up.

sudo systemctl stop lighttpd.service
sudo systemctl start lighttpd.service
sudo systemctl enable lighttpd.service

Install MariaDB

Joomla also requires a database server; the MariaDB database server is a great place to start. To install it, run the commands below.

sudo apt install mariadb-server mariadb-client

After installation, the commands below can stop, start, and enable the MariaDB service to start up when the server boots.

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service

After that, run the commands below to secure the MariaDB server.

sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

  • Enter current password for root (enter for none): Press the Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]:  Y
  • Reload privilege tables now? [Y/n]:  Y

Install PHP 7.1 FastCGI  and Related Modules

PHP 7.1 isn’t available on Ubuntu’s default repositories. So, to install it, you will have to get it from third-party repositories.

Run the commands below to add the below third party repository to upgrade to PHP 7.1

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Then update and upgrade to PHP 7.1

sudo apt update

After that, run the commands below to install PHP7.1-FastCGI and related PHP modules. Of course, many PHP modules perform different functions. However, the ones below may be needed when developing PHP-based websites.

sudo apt install php7.1-cgi php7.1-mcrypt php7.1-cli php7.1-mysql php7.1-gd php7.1-imagick php7.1-xml php7.1-recode php7.1-tidy php7.1-xmlrpc

After installing PHP7.1-FastCGI, you can enable PHP-FastCGI modules by running the commands below.

sudo sudo lighttpd-enable-mod fastcgi 
sudo lighttpd-enable-mod fastcgi-php

If the commands above fail, install the package below.

sudo apt install libterm-readline-gnu-perl

Then, run the commands to enable the modules again; this time, they should work.

 sudo /etc/init.d/lighttpd force-reload

Create Joomla Database

Now that you’ve installed all the required packages continue below to start configuring the servers.

First, run the commands below to create a blank Joomla database.

To log on to the MariaDB database server, run the commands below.

sudo mysql -u root -p

Then, create a database called Joomla DB.

CREATE DATABASE joomladb;

Create a database user called joomlauser with a new password

CREATE USER 'joomlauser'@'localhost' IDENTIFIED BY 'new_password_here';

Then, grant the user full access to the database.

GRANT ALL ON joomladb.* TO 'joomlauser'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;

Finally, save your changes and exit.

FLUSH PRIVILEGES;
EXIT;

Configure Lighttpd PHP-FastCGI Settings

Next, you may want to configure Lighttpd to use PHP server scripting properly. The default PHP-FastCGI configuration file is located at /etc/php/7.1/cgi/php.ini

Open the PHP Lighttpd configuration file by running the commands below

sudo nano /etc/php/7.1/cgi/php.ini

Then, edit the file to suit your environment. Some crucial lines to consider:

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
cgi.fix_pathinfo=0
date.timezone = America/Chicago

Next, open the Lighttpd site configuration file. By default, it’s stored at /etc/Lighttpd/lighttpd.conf

sudo nano /etc/lighttpd/lighttpd.conf

Then, configure the highlighted lines below to enable its rewrite module, create a VirtualHost for our site, and save the file. Remember to replace example.com with your domain name.

server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
        "mod_rewrite",
)


$HTTP["host"] =~ "(^|www\.)example.com$" {
    server.document-root = "/var/www/html/joomla"
    server.errorlog      = "/var/log/lighttpd/example.com-error.log"
    server.error-handler-404 = "/index.php"
}

server.document-root        = "/var/www/html"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80


index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
## Use ipv6 if available
#include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

Next, run the commands below to open the FastCGI default configuration file for Lighttpd.

sudo nano /etc/lighttpd/conf-available/15-fastcgi-php.conf

Then confirm that PHP-FastCGI is configured, as shown in the highlighted portion below, to use PHP 7.1.

# -*- depends: fastcgi -*-
# /usr/share/doc/lighttpd/fastcgi.txt.gz 
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi

## Start an FastCGI server for php (needs the php7.1-cgi package)
fastcgi.server += ( ".php" =>
        ((
                "bin-path" => "/usr/bin/php-cgi7.1",
                "socket" => "/var/run/lighttpd/php.socket",
                "max-procs" => 1,
                "bin-environment" => (
                        "PHP_FCGI_CHILDREN" => "4",
                        "PHP_FCGI_MAX_REQUESTS" => "10000"
                ),
                "bin-copy-environment" => (
                        "PATH", "SHELL", "USER"
                ),
                "broken-scriptfilename" => "enable"
        ))
)

Download Joomla Package

Next, run the commands below to download Joomla’s latest release.

cd /tmp && wget https://github.com/joomla/joomla-cms/releases/download/3.8.0/Joomla_3.8.0-Stable-Full_Package.zip

Then, run the commands below to install and unzip the package, create a Joomla folder in the Apache2 root folder, and extract the Joomla archived file.

sudo apt-get install unzip
sudo mkdir -p /var/www/html/joomla
sudo unzip Joomla*.zip -d /var/www/html/joomla

Change and modify the directory permission.

sudo chown -R www-data:www-data /var/www/html/joomla
sudo chmod -R 755 /var/www/html/joomla

Restart Lighttpd services

sudo systemctl restart lighttpd.service

After that, open your browser and browse your domain name to launch the Joomla configuration wizard.

ex. http://example.com

Follow the onscreen instructions until you’ve successfully installed Joomla.

Enjoy!

Like this:



One response to “How to install Joomla with Lighttpd on Ubuntu Linux”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.