How To Install Let’s Encrypt SSL With Lighttpd on CentOS 7

Let’s Encrypt SSL With Lighttpd on CentOS 7

LetsEncrypt is a free open certificate authority (CA) that provides free certificates for websites and other services. The service, which is backed by the Electronic Frontier Foundation, Mozilla, Cisco Systems, and Akamai. Unfortunately, LetsEncrypt.org certificates currently have a 3 month lifetime. This means you’ll need to renew your certificate quarterly for now.

Table of Contents

Step 1. First let’s start by ensuring your system is up-to-date.

Step 2. Installing Let’s Encrypt SSL using Certbot.

Step 3. Configure Lighttpd For Your New Cert.

Step 4. Force HTTPS requests for Lighttpd.

Step 5. Set Up Let’s Encrypt SSL Auto Renewal.

 

 Prerequisites

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Let’s Encrypt SSL with Lighttpd on a CentOS 7 server.
Install Let’s Encrypt SSL With Lighttpd on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Installing Let’s Encrypt SSL using Certbot.

In CentOS 7, you can find Certbot on the EPEL repository; if you enable it, just install what you need:

yum install epel-release
yum install certbo

You will also need to have Lighttpd installed and running. Of course, if you are adding certificates onto a previously configured web host this would already be installed:

yum -y install lighttpd
systemctl start lighttpd.service

Obtaining a certificate with Certbot:

certbot certonly --webroot -w /var/www/wpcademy.com -d wpcademy.com -d www.wpcademy.com

Combine both certificate and private key in one file.

Lighty likes its certificates formatted in a specific way, so we’re going to combine the private keys and certificate into one file that we’ll tell lighty about later:

cat /etc/letsencrypt/live/idroot.us/privkey.pem /etc/letsencrypt/live/wpcademy.com/cert.pem > /etc/letsencrypt/live/idroot.us/combined.pem

Step 3. Configure Lighttpd For Your New Cert.

Configure lighty to use the new certificate and chain:

nano /etc/lighttpd/lighttpd.conf

Use the below information:

$SERVER["socket"] == ":443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/letsencrypt/live/wpcademy.com/web.pem"
ssl.ca-file = "/etc/letsencrypt/live/wpcademy.com/chain.pem"
server.name = "wpcademy.com" 
server.document-root = "/var/www/wpcademy.com"
server.errorlog = "/var/log/lighttpd/wpcademy.com_error.log"
accesslog.filename = "/var/log/lighttpd/wpcademy.com_access.log"

Step 4. Force HTTPS requests for Lighttpd.

We can also configure HTTP to HTTPS redirection on Lighttpd server so that the traffic comes to non-HTTPS site redirect to the HTTPS site:

$HTTP["scheme"] == "http" {
$HTTP["host"] == "wpcadem.com" {
url.redirect = ("/.*" => "https://idroot.us$0")
}
}

Save and close the file when you are finished.

Step 5. Set Up Let’s Encrypt SSL Auto Renewal.

Let’s Encrypt certificates comes with a validity of 90 days; it is highly advisable to configure the cron (Linux Scheduler) job to renew your certificates before they expire:

certbot renew --dry-run

If that appears to be working properly, configure a cron job for the below command:

certbot renew

Congratulation’s! You have successfully installed Let’s Encrypt. Thanks for using this tutorial for installing Let’s Encrypt SSL With Lighttpd on CentOS 7 system. For additional help or useful information, we recommend you to check the official Let’s Encrypt web site.

How To Install Lighttpd With MariaDB and PHP on Ubuntu 18.04 LTS

Install Lighttpd With MariaDB and PHP on Ubuntu

Lighttpd is a fast and secure web-server which has been optimized for high-performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the perfect solution for every server that is suffering load problems.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Lighttpd With MariaDB and PHP FastCGI on Ubuntu 18.04 Bionic Beaver server.

Install Lighttpd With MariaDB and PHP on Ubuntu 18.04 LTS Bionic Beaver

 

Step 1. First make sure that all your system packages are up-to-date

apt-get update
apt-get upgrade

Step 2. Installing Lighttpd on Ubuntu 18.04 LTS.

Lighttpd is available to install from the official Ubuntu repositories, So if you want to install Lighttpd, you only have to run this command:

sudo apt install lighttpd

To start up Lighttpd webserver, run the commands below and You can test the status of the server by accessing the IP address of your VPS in a web browser. Upon success, you will see the Lighttp welcome page:

systemctl start lighttpd.service

Step 3. Installing MariaDB on Ubuntu 18.04 LTS.

To install MariaDB in Ubuntu run the following command:

sudo apt install mariadb-server mariadb-client

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

To log into MariaDB, use the following command (note that it’s the same command you would use to log into a MySQL database):

mysql -u root -p

To start the database, run the commands below:

systemctl start mariadb.service

Step 4. Installing PHP 7 FastCGI and other PHP7 modules.

First, 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, install and upgrade to PHP 7.1:

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

Enable PHP CGI modules in Lighttpd with the following commands:

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

After enabling the modules, you need to restart the Lighttpd service by running the following command:

systemctl restart lighttpd

Testing if PHP is working:

nano /srv/www/htdocs/info.php

Then, we’ll simply add the following line into the file:

<?php phpinfo(); ?>

Step 5. Configure firewall for LLMP.

Run following commands to allow HTTP (80) and HTPPS (443) request through the firewall.

ufw allow 80/tcp
ufw allow 443/tcp
ufw reload

Congratulations! You have successfully installed LLMP. Thanks for using this tutorial for installing Lighttpd With PHP FPM and MariaDB in Ubuntu 18.04 LTS Bionic Beaver systems. For additional help or useful information, we recommend you to check the official Lighttpd web site.

How To Install Lighttpd With PHP And MariaDB on Ubuntu 16.04 LTS

Install Lighttpd With PHP And MariaDB on Ubuntu 16

Lighttpd is a fast and secure web-server which has been optimized for high-performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the perfect solution for every server that is suffering load problems.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Lighttpd With PHP FPM And MariaDB on Ubuntu 16.04 Xenial Xerus server.

Install Lighttpd With PHP and MariaDB on Ubuntu 16.04 LTS

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

apt-get update
apt-get upgrade

Step 2. Installing Lighttpd on Ubuntu 16.04.

Lighttpd is available to install from the official Ubuntu repositories, So if you want to install Lighttpd, you only have to run this command:

apt-get install lighttpd

To start up Lighttpd webserver, run the commands below and You can test the status of the server by accessing the IP address of your VPS in a web browser. Upon success, you will see the Lighttp welcome page:

systemctl start lighttpd.service

Step 3. Installing MariaDB.

To install MariaDB in Ubuntu run the following command:

apt-get install mariadb-server

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

To log into MariaDB, use the following command (note that it’s the same command you would use to log into a MySQL database):

mysql -u root -p

To start the database, run the commands below:

systemctl start mariadb.service

Step 4. Installing PHP and other PHP7 modules.

Next, run the commands below to install PHP5 and other PHP modules:

apt-get -y install php-fpm php-mysql

Enable PHP CGI modules in Lighttpd with the following commands:

sudo lighty-enable-mod fastcgi 
sudo lighty-enable-mod fastcgi-php

After enabling the modules, you need to restart the Lighttpd service by running the following command:

systemctl restart lighttpd

Testing if PHP is working:

nano /srv/www/htdocs/info.php

Then, we’ll simply add the following line into the file:

<?php phpinfo(); ?>

Step 5. Configure firewall for LLMP.

Run following commands to allow HTTP (80) and HTPPS (443) request through the firewall.

ufw allow 80/tcp
ufw allow 443/tcp
ufw reload

Congratulations! You have successfully installed LLMP. Thanks for using this tutorial for installing Lighttpd With PHP FPM and MariaDB in Ubuntu 16.04 Xenial Xerus systems. For additional help or useful information, we recommend you to check the official Lighttpd web site.

How To Install Lighttpd on Ubuntu 14.10

Install Lighttpd on Ubuntu

Lighttpd is a fast and secure web-server which has been optimized for high-performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the perfect solution for every server that is suffering load problems. This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. Here’s a brief tutorial will explain you the installation of Lighttpd web server on Ubuntu.

In this tutorial we will show you how to install and configuration of Lighttpd on your Ubuntu 14.04 server.

Install Lighttpd on Ubuntu 14.10

Step 1. Installing Lighttpd.

Lighttpd is available to install from the official Ubuntu repositories, So if you want to install Lighttpd, you only have to run this command.

 sudo apt-get install lighttpd

Step 2. Installing PHP5 and modules.

Ubuntu provides a FastCGI-enabled PHP5 package. We can install by issuing the following command.

 sudo apt-get install php5-cgi php5-mysql

Enable fast-cgi support.

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

Step 3. Start Lighttpd server.

 /etc/init.d/lighttpd force-reload

Step 4. Testing Lighttpd webserver.

To make sure everything installed correctly we will now test Lighttpd to ensure it is working properly. Open up any web browser and then enter the following into the web address:

 http://localhost/ or http://your.ip.addr.ess

lighttpd-ubuntu

Note: Lighttpd’s default document root is /var/www on Ubuntu, and the configuration file is /etc/lighttpd/lighttpd.conf. Additional configurations are stored in files in the /etc/lighttpd/conf-available.

Congratulation’s! You have successfully installed Lighttpd. Thanks for using this tutorial for installing Lighttpd web server on ubuntu 14.04 system. For additional help or useful information, we recommend you to check the official Lighttpd web site.

You Might Also Like: How To Install Lighttpd on CentOS