Raspberry Pi as server

Setup & config options

Apache 2.4+ LAMP server

»Windward« server

The game & not the islands
 Setup & config options

Some off-topics
Free weather app. Weather widget

Lat. 52.27, Long. 8.01

 

Meteorological service

Front desk clerk

🚫  No ads & tracking

Tag cloud
QRC bookmark

QR quick response code




Github VSCO Vimeo | Madeira | Madeirense Watch on Youtube

The prologue


Most of the articles, descriptions and instructions written here are applicable to the most common Debian-based Linux derivatives. Depending on the respective operating system, there may be minor or major discrepancies.
This website is for educational purposes only. Please do not deploy anything in manufacturing plants.
No warranty or compensation is given for loss of data or hardware.

It should be also mentioned that this modest web server is hosted on a Raspberry Pi type 4B at home.


The Raspberry Pi mini-computer board as multi-purpose server deployed
A competent allrounder for domestic purposes and micro-enterprises


Raspberry Pi : Apache as multiple web server. Print server, scan server, backup and NAS server. Raspberry Pi : Apache as multiple web server. Print server, scan server, backup and NAS Server.

Raspberry Pi is a series of small single-board computers (SBCs) developed in the United Kingdom by the Raspberry Pi Foundation in association with Broadcom. The mini-computer with its armv7l processor has quickly become the favourite of hobbyists. Projects can be started with suitable Linux distributions. Even an aged RasPi e.g. the models 2B and 2B+ can definitely serve to simple tasks quite well.


Raspberry Pi | Install php5, mySQL and phpMyAdmin


Initially bring your system up to date and reboot your machine if needed.


user@raspberry:~ $ sudo su
root@raspberry:~# apt update && apt upgrade && apt dist-upgrade
user@raspberry:~ $ shutdown -r now


Install php, php5 script language


Fundamental services are required to turn the Raspberry Pi into a real web server consisting of Apache - the web server itself -, php script language and MySQL database module. When installed on a Linux based system, the collective term is »LAMP«.


php php5 logo

»L«inux  »A«pache  »M«ySQL  »P«HP


To allow the web server to process php files, you'll need to install php and the php module for Apache. Start your terminal program e.g. PuTTy http://www.putty.org/ and login to your Raspberry. Continue as superuser.


user@raspberry:~ $ sudo su
root@raspberry:~# apt install php5 libapache2-mod-php5
root@raspberry:~# service apache2 restart


The root directory for web content was /var/www until Raspbian Wheezy but now is /var/www/html since Raspbian Stretch.


Rename the file in directory /var/www/html/index.html.


Be sure to check you’re not deleting files you need before running.


root@raspberry:~# cd /var/www/html
root@raspberrypi:/var/www/html# mv index.html index.old


Create a simple file index.php in /var/www/html/.


root@raspberrypi:/var/www/html# nano index.php


php5 logo


        <?php phpinfo(); ?>
	

You can use a plain phpinfo() info page to view the current php details for your web server.
This file outputs a large amount of information:


◦ Information about php compilation options and extensions
◦ php version
◦ Server information and environment (if compiled as a module)
◦ php environment
◦ OS version information, paths, master and local values of configuration options
◦ http headers
◦ php license


Install mySQL database


mySQL logo

MySQL is a very popular database engine for example to http://www.phpbb.com/. Like the php language script, its overwhelming presence on web servers enhanced its popularity. Most likely php and MySQL both work together.

We need to install MySQL server and the Python bindings for mySQL.



When installing MySQL you will be asked for a root password. Remember this to allow your website to access the MySQL database.


user@raspberry:~ $ sudo su
root@raspberry:~# apt install mysql-server mysql-client php5-mysql
root@raspberry:~# service apache2 restart


Install phpMyAdmin management system


myphpadmin logo

phpMyAdmin is a software tool to bring MySQL to the Web. phpMyAdmin is a tool written in php intended to handle the administration of MySQL. Currently it can create and drop databases, create/drop/alter tables, delete/edit/add columns, execute any SQL statement, manage indexes on columns.


user@raspberry:~ $ sudo su
root@raspberry:~# apt install phpmyadmin


The installation routine will ask you for few configuration options where here will not be explained.


When installation is finished, open /etc/php5/apache2/php.ini with a text editor and find the »Dynamic Extensions« section.


root@raspberry:~# nano /etc/php5/apache2/php.ini


Just add between Dynamic & Module the two lines:


		;;;;;;;;;;;;;;;;;;;;;;
		; Dynamic Extensions ;
		;;;;;;;;;;;;;;;;;;;;;;
        extension=msqli.so OR extension=/PATH_TO_EXTENSION/msqli.so
        extension=msql.so OR extension=/PATH_TO_EXTENSION/msql.so
		;;;;;;;;;;;;;;;;;;;
		; Module Settings ;
		;;;;;;;;;;;;;;;;;;;
        

Now you have the MySQL extensions for php enabled.


Afterwards, run this command:

root@raspberry:~# sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin


This links your server's document root to /var/www/html/ on Raspbian OS machines.


Due to security reasons you should use a different sub-folder.


For example : /var/www/html/a-d-m-i-n-0815/phpmyadmin


Restart the Apache service.


root@raspberry:~# service apache2 restart


Access phpMyAdmin by http://www.yourdomain.tld/phpmyadmin .


Few textual parts to this article were taken from the Official forum Raspberrypi.Org.


»Wordpress CMS« content management system


WordPress is a free content management system. It was programmed by in 2003 as software for weblogs and is constantly being further developed as an open source project. WordPress is the most widespread system for operating websites of all CMSs; among one million of the most visited websites, about one third uses WordPress. In WordPress, each post can be assigned to freely definable categories, and navigation elements are automatically generated to match.


https://projects.raspberrypi.org/en/projects/lamp-web-server-with-wordpress

https://wordpress.org/support/article/how-to-install-wordpress/


The RasPi 2B+ is not a particularly fastest machine. I believe that Wordpress is bit too hard for the old Pi. The latest models 3 and 4 should deal with it.


18-Oct 2017
Updated 08-Feb 2021

dosboot.org 2024 | Design and layout handmade in Northwest Europe