How to install Grav CMS with Lighttpd Web Server
- 00:45 Cat /etc/os-release
- 01:00 apt install lighttpd -y
- 01:52 systemctl enable lighttpd
- 02:05 systemctl start lighttpd
- 02:22 systemctl status lighttpd
- 02:40 apt install php php-cli php-fpm php-mbstring php-xml php-json php-curl php-zip php-intl php-gd php-cgi -y
- 03:12 vim /etc/php/7.4/fpm/php.ini
- 04:02 lighty-enable-mod fastcgi
- 04:18 lighty-enable-mod fastcgi-php
- 04:27 systemctl reload lighttpd
- 04:41 cd /var/www/html/
- 04:53 wget https://getgrav.org/download/core/grav-admin/latest -O grav-admin.zip
- 05:06 unzip grav-admin.zip -d grav
- 05:45 mv grav grav2
- 06:00 mv grav2/grav-admin/ /var/www/html/grav
- 06:22 vim /etc/lighttpd/lighttpd.conf
- 06:46 chown -R www-data:www-data /var/www/html/grav
- 07:12 chmod -R 755 /var/www/html/grav
- 07:36 systemctl restart lighttpd
To Install Grav CMS With Lighttpd Web Server On Ubuntu 20.04
Introduction:
Grav is an open-source flat-file content management system (CMS) known for its lightweight design and flexibility. Lighttpd, also referred to as "Lighty," is a high-performance and secure web server. Integrating Grav with Lighttpd creates a sturdy foundation for web content creation and management, eliminating the need for a traditional database-driven system.
Installation Steps:
Step 1: Check the OS version by using the below command
root@ubuntu:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
Step 2: Install lighttpd web server by using the below command
root@ubuntu:~# apt install lighttpd -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
gamin libgamin0 spawn-fcgi
Suggested packages:
rrdtool php-cgi apache2-utils lighttpd-doc lighttpd-mod-authn-gssapi lighttpd-mod-authn-pam
lighttpd-mod-authn-sasl lighttpd-mod-cml lighttpd-mod-geoip lighttpd-mod-magnet
lighttpd-mod-maxminddb lighttpd-mod-trigger-b4-dl lighttpd-mod-vhostdb-dbi lighttpd-mod-vhostdb-pgsql
lighttpd-mod-webdav lighttpd-modules-ldap lighttpd-modules-mysql
The following NEW packages will be installed:
gamin libgamin0 lighttpd spawn-fcgi
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 398 kB of archives.
After this operation, 1,539 kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 libgamin0 amd64 0.1.10-6 [16.2 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 gamin amd64 0.1.10-6 [43.7 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu focal-updates/universe amd64 lighttpd amd64 1.4.55-1ubuntu1.20.04.2 [324 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 spawn-fcgi amd64 1.6.4-2 [14.9 kB]
Fetched 398 kB in 2s (165 kB/s)
Selecting previously unselected package libgamin0.
(Reading database ... 161828 files and directories currently installed.)
Preparing to unpack .../libgamin0_0.1.10-6_amd64.deb ...
Unpacking libgamin0 (0.1.10-6) ...
Selecting previously unselected package gamin.
Preparing to unpack .../gamin_0.1.10-6_amd64.deb ...
Unpacking gamin (0.1.10-6) ...
Selecting previously unselected package lighttpd.
Preparing to unpack .../lighttpd_1.4.55-1ubuntu1.20.04.2_amd64.deb ...
Unpacking lighttpd (1.4.55-1ubuntu1.20.04.2) ...
Selecting previously unselected package spawn-fcgi.
Preparing to unpack .../spawn-fcgi_1.6.4-2_amd64.deb ...
Unpacking spawn-fcgi (1.6.4-2) ...
Setting up spawn-fcgi (1.6.4-2) ...
Setting up libgamin0 (0.1.10-6) ...
Setting up lighttpd (1.4.55-1ubuntu1.20.04.2) ...
Enabling unconfigured: ok
Run "service lighttpd force-reload" to enable changes
Created symlink /etc/systemd/system/multi-user.target.wants/lighttpd.service → /lib/systemd/system/lightt
pd.service.
Setting up gamin (0.1.10-6) ...
Processing triggers for libc-bin (2.31-0ubuntu9.15) ...
Processing triggers for ufw (0.36-6ubuntu1.1) ...
Processing triggers for systemd (245.4-4ubuntu3.23) ...
Processing triggers for man-db (2.9.1-1) ...
Step 3: Enable and start the lighttpd Service by using the below command
root@ubuntu:~# systemctl enable lighttpd
Synchronizing state of lighttpd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable lighttpd
root@ubuntu:~# systemctl start lighttpd
Step 4: Check the status of the lighttpd service by using the below command
root@ubuntu:~# systemctl status lighttpd
● lighttpd.service - Lighttpd Daemon
Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2024-06-07 05:31:47 PDT; 1min 26s ago
Main PID: 3243 (lighttpd)
Tasks: 1 (limit: 4556)
Memory: 1008.0K
CGroup: /system.slice/lighttpd.service
└─3243 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
Jun 07 05:31:47 ubuntu systemd[1]: Starting Lighttpd Daemon...
Jun 07 05:31:47 ubuntu systemd[1]: Started Lighttpd Daemon.
Step 5: Install php and its modules by using the below command
root@ubuntu:~# apt install php php-cli php-fpm php-mbstring php-xml php-json php-curl php-zip php-intl php-gd php-cgi -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.4 libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap libcurl4 liblua5.2-0 libonig5 libzip5 php-common php7.4
php7.4-cgi php7.4-cli php7.4-common php7.4-curl php7.4-fpm php7.4-gd php7.4-intl php7.4-json
php7.4-mbstring php7.4-opcache php7.4-readline php7.4-xml php7.4-zip
Suggested packages:
apache2-doc apache2-suexec-pristine | apache2-suexec-custom php-pear
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.4 libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap libcurl4 liblua5.2-0 libonig5 libzip5 php php-cgi php-cli
php-common php-curl php-fpm php-gd php-intl php-json php-mbstring php-xml php-zip php7.4 php7.4-cgi
php7.4-cli php7.4-common php7.4-curl php7.4-fpm php7.4-gd php7.4-intl php7.4-json php7.4-mbstring
php7.4-opcache php7.4-readline php7.4-xml php7.4-zip
0 upgraded, 39 newly installed, 0 to remove and 0 not upgraded.
Need to get 9,833 kB of archives.
After this operation, 44.3 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu focal/main amd64 libapr1 amd64 1.6.5-1ubuntu1 [91.4 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libaprutil1 amd64 1.6.1-4ubuntu2.2 [85.1 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libaprutil1-dbd-sqlite3 amd64 1.6.1-4ubuntu2.2 [10.5 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libaprutil1-ldap amd64 1.6.1-4ubuntu2.2 [8,752 B]
Get:5 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 libcurl4 amd64 7.68.0-1ubuntu2.22 [235 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu focal/main amd64 liblua5.2-0 amd64 5.2.4-1.1build3 [106 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 apache2-bin amd64 2.4.41-4ubuntu3.17 [1,187 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 apache2-data all 2.4.41-4ubuntu3.17 [158 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 apache2-utils amd64 2.4.41-4ubuntu3.17 [84.1 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 apache2 amd64 2.4.41-4ubuntu3.17 [95.5 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu focal/main amd64 php-common all 2:75 [11.9 kB]
Preparing to unpack .../38-php-zip_2%3a7.4+75_all.deb ...
Unpacking php-zip (2:7.4+75) ...
Setting up php-common (2:75) ...
Created symlink /etc/systemd/system/timers.target.wants/phpsessionclean.timer → /lib/systemd/system/phpse
ssionclean.timer.
Setting up php7.4-common (7.4.3-4ubuntu2.22) ...
Creating config file /etc/php/7.4/mods-available/calendar.ini with new version
Creating config file /etc/php/7.4/mods-available/ctype.ini with new version
Creating config file /etc/php/7.4/mods-available/exif.ini with new version
Creating config file /etc/php/7.4/mods-available/sysvshm.ini with new version
Creating config file /etc/php/7.4/mods-available/tokenizer.ini with new version
Setting up libzip5:amd64 (1.5.1-0ubuntu1) ...
Module mpm_event disabled.
Enabling module mpm_prefork.
info: Executing deferred 'a2enmod php7.4' for package libapache2-mod-php7.4
Enabling module php7.4.
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2
.service.
Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/sy
stem/apache-htcacheclean.service.
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "start" failed.
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2024-06-07 05:34:49 PDT; 27ms ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 20438 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Jun 07 05:34:49 ubuntu apachectl[20441]: AH00558: apache2: Could not reliably determine the server's full
y qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this messag
e
Jun 07 05:34:49 ubuntu apachectl[20441]: (98)Address already in use: AH00072: make_sock: could not bind t
o address [::]:80
Jun 07 05:34:49 ubuntu apachectl[20441]: (98)Address already in use: AH00072: make_sock: could not bind t
o address 0.0.0.0:80
Jun 07 05:34:49 ubuntu apachectl[20441]: no listening sockets available, shutting down
Jun 07 05:34:49 ubuntu apachectl[20441]: AH00015: Unable to open logs
Jun 07 05:34:49 ubuntu apachectl[20438]: Action 'start' failed.
Jun 07 05:34:49 ubuntu apachectl[20438]: The Apache error log may have more information.
Jun 07 05:34:49 ubuntu systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Jun 07 05:34:49 ubuntu systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 07 05:34:49 ubuntu systemd[1]: Failed to start The Apache HTTP Server.
Processing triggers for ufw (0.36-6ubuntu1.1) ...
Processing triggers for systemd (245.4-4ubuntu3.23) ...
Processing triggers for man-db (2.9.1-1) ...
Step 6: By default, PHP may need some adjustments to work optimally with lighttpd. For that edit the PHP configuration file by using the below command.
root@ubuntu:~# vim /etc/php/7.4/fpm/php.ini
Ensure the below line in php.ini file was uncommented
cgi.fix_pathinfo=1
Save and close the file (Ctrl+X, Y, Enter).
Step 7: Enable and configure the PHP FastCGI module in lighttpdny using the below commands.
root@ubuntu:~# lighty-enable-mod fastcgi
Enabling fastcgi: ok
Run "service lighttpd force-reload" to enable changes
root@ubuntu:~# lighty-enable-mod fastcgi-php
Enabling fastcgi-php: ok
Run "service lighttpd force-reload" to enable changes
root@ubuntu:~# systemctl reload lighttpd
Step 8: Navigate to the document root directory of lighttpd and download the latest Grav release
root@ubuntu:~# cd /var/www/html/
root@ubuntu:/var/www/html# wget https://getgrav.org/download/core/grav-admin/latest -O grav-admin.zip
--2024-06-07 05:40:50-- https://getgrav.org/download/core/grav-admin/latest
Resolving getgrav.org (getgrav.org)... 172.67.72.160, 104.26.3.204, 104.26.2.204, ...
Connecting to getgrav.org (getgrav.org)|172.67.72.160|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github.com/getgrav/grav/releases/download/1.7.46/grav-admin-v1.7.46.zip [following]
--2024-06-07 05:40:51-- https://github.com/getgrav/grav/releases/download/1.7.46/grav-admin-v1.7.46.zip
Resolving github.com (github.com)... 20.207.73.82
Connecting to github.com (github.com)|20.207.73.82|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/22553797/23021972-4ba2-4dcf-bc0a-24b072e59880?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20240607%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240607T124051Z&X-Amz-Expires=300&X-Amz-Signature=da237f5e20931bcd570cf076bce0af8fccc9c88337864cef0666d7fdcb61ebce&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=22553797&response-content-disposition=attachment%3B%20filename%3Dgrav-admin-v1.7.46.zip&response-content-type=application%2Foctet-stream [following]
--2024-06-07 05:40:51-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/22553797/23021972-4ba2-4dcf-bc0a-24b072e59880?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20240607%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240607T124051Z&X-Amz-Expires=300&X-Amz-Signature=da237f5e20931bcd570cf076bce0af8fccc9c88337864cef0666d7fdcb61ebce&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=22553797&response-content-disposition=attachment%3B%20filename%3Dgrav-admin-v1.7.46.zip&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.111.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18900376 (18M) [application/octet-stream]
Saving to: ‘grav-admin.zip’
grav-admin.zip 100%[=====================================>] 18.02M 9.99MB/s in 1.8s
2024-06-07 05:40:54 (9.99 MB/s) - ‘grav-admin.zip’ saved [18900376/18900376]
Step 9: Unzip download Grav file by using the below command.
root@ubuntu:/var/www/html# unzip grav-admin.zip -d grav
Archive: grav-admin.zip
creating: grav/grav-admin/
creating: grav/grav-admin/tmp/
inflating: grav/grav-admin/tmp/.gitkeep
creating: grav/grav-admin/.github/
inflating: grav/grav-admin/.github/FUNDING.yml
inflating: grav/grav-admin/LICENSE.txt
inflating: grav/grav-admin/README.md
inflating: grav/grav-admin/SECURITY.md
creating: grav/grav-admin/logs/
inflating: grav/grav-admin/logs/.gitkeep
creating: grav/grav-admin/backup/
inflating: grav/grav-admin/backup/.gitkeep
inflating: grav/grav-admin/CODE_OF_CONDUCT.md
inflating: grav/grav-admin/.htaccess
creating: grav/grav-admin/system/
inflating: grav/grav-admin/system/defines.php
creating: grav/grav-admin/system/assets/
creating: grav/grav-admin/system/assets/jquery/
inflating: grav/grav-admin/vendor/rockettheme/toolbox/Compat/src/Yaml/Yaml.php
inflating: grav/grav-admin/vendor/rockettheme/toolbox/Compat/src/Yaml/Parser.php
inflating: grav/grav-admin/vendor/rockettheme/toolbox/Compat/src/Yaml/Inline.php
inflating: grav/grav-admin/vendor/rockettheme/toolbox/Compat/src/Yaml/Unescaper.php
inflating: grav/grav-admin/CONTRIBUTING.md
inflating: grav/grav-admin/index.php
inflating: grav/grav-admin/now.json
creating: grav/grav-admin/webserver-configs/
inflating: grav/grav-admin/webserver-configs/lighttpd.conf
inflating: grav/grav-admin/webserver-configs/web.config
inflating: grav/grav-admin/webserver-configs/nginx.conf
inflating: grav/grav-admin/webserver-configs/htaccess.txt
inflating: grav/grav-admin/webserver-configs/Caddyfile-0.8.x
inflating: grav/grav-admin/webserver-configs/Caddyfile
creating: grav/grav-admin/images/
inflating: grav/grav-admin/images/.gitkeep
inflating: grav/grav-admin/composer.json
inflating: grav/grav-admin/composer.lock
root@ubuntu:/var/www/html# mv grav grav2
root@ubuntu:/var/www/html# mv grav2/grav-admin/ /var/www/html/grav
root@ubuntu:/var/www/html# rm -rf grav2/
Step 10: Edit the lighttpd configuration file to set up Grav by using the below command
root@ubuntu:/var/www/html# vim /etc/lighttpd/lighttpd.conf
Add the below lines in the end of configuration file.
server.module += ("mod_rewrite")
$HTTP["host"] =~ ".*" {
server.document-root = "/var/www/html/grav"
url.rewrite-if-not-file = ( "" => "/index.php" )
}
Step 11: Grant Permission and Set Ownership for Grav CMS by using the below command
root@ubuntu:/var/www/html# chown -R www-data:www-data /var/www/html/grav
root@ubuntu:/var/www/html# chmod -R 755 /var/www/html/grav
Step 12: After making configuration changes, restart lighttpd to apply the new settings.
root@ubuntu:/var/www/html# systemctl restart lighttpd
Step 13: Open the Web browser and search the IP address as shown in the below image
Here create a admin account to ensure your GRAV install is secure.
This is the Dashboard page of Grav CMS
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to Install Grav CMS with lighttpd Web Server On ubuntu 22.04. Your feedback is much welcome.
Comments ( 0 )
No comments available