Web Server

Apache

Install Apache 2, use SFTP as it uses SSH, so no need to install pureFTP, or similar.   https://help.ubuntu.com/community/PureFTP

https://www.raspberrypi.org/documentation/remote-access/web-server/apache.md Continue on to install all the requirements for WordPress.  https://www.raspberrypi.org/learning/lamp-web-server-with-wordpress/worksheet/

sudo apt-get install apache2
sudo chown pi /var/www/html
# enable rewrite mod
sudo a2enmod rewrite

PHP

sudo apt-get install php5 libapache2-mod-php5 -y

MySQL

sudo apt-get install mysql-server
# enter a password for mysql root user
# install ancillary packages 
sudo apt-get install mysql-client php5-mysql
# restart apache2
/etc/init.d/apache2 restart

phpMyAdmin


apt-get install phpmyadmin
# select which http server to configure (apache2)
# configure database with dbconfig-common (select yes)
# provide mysql admin user password to install phpmyadmin
# provide mysql password for phpmyadmin 
# configure apache to work with phpmyadmin
vi /etc/apache2/apache2.conf 
# add the line Include /etc/phpmyadmin/apache.conf
# restart apache
/etc/init.d/apache2 restart

Log Files

Apache2 provides an access and an error log in the /var/log/apache2/ directory.  access.log  contains all details of requests processed by the server including the IP address the request originated from, timestamp and user agent.   All messages and errors from the server are stored in error.log.  For example

AH00558: apache2: Could not reliably determine the server's 
fully qualified domain name, using 127.0.1.1. Set the 
'ServerName' directive globally to suppress this message

Virtual Hosts

As soon as you want to host multiple sites from the server, then it is necessary to work with the configuration files.  Apache2 loads configuration data from individual files as an alternative to editing a long configuration file which may introduce errors.

# create a file in /etc/apache2/conf-available/
sudo vi /etc/apache2/conf-available/servername.conf
# this will remove the AH00558 error above

# copy default site file
cd /etc/apache2/sites-available/
cp 000-default.conf test.domain.conf

# edit test.domain.conf, specify ServerName and DocumentRoot
vi test.domain.conf
ServerName test.domain
DocumentRoot /var/www/test/

# create DocumentRoot and adjust permissions
mkdir /var/www/test
chmod -R 755 /var/www/test/
chown -R www-data:www-data /var/www/test 

Domain Name Troubleshooting – https://lookup.mxtoolbox.com/domain/blueshrapnel.co.uk/

SSL

Benchmarking

fail2ban

Other links

Leave a Reply

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