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 social media VSCO social media Vimeo social media | Madeira | Madeirense Twitter | X Youtube social media

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.


Apache web server v2.4+ »ErrorDocument« handling

Troubleshooting | Custom »ErrorDocument«


apache.org writes : Although the Apache http Server provides generic error responses in the event of 4xx or 5xx http status codes, these responses are rather stark, uninformative, and can be intimidating to site users. You may wish to provide custom error responses which are either friendlier, or in some language other than English, or perhaps which are styled more in line with your site layout.


Assuming the Apache web server service on a Raspberry Pi with Apache v2.4+ is properly installed and configured for the first - ? - time.


A /.htaccess file is not placed in the document /root folder /var/www/html/.


The custom composed »ErrorDocument 403« or »ErrorDocument 404« to /path_to/404.html and /or /path_to/403.html do not show up ?


For the solution without using a general /.htaccess file.


Launch »PuTTy« or an other favourite similar terminal SSH-client to log-in to your RasPi and type :


user@raspberry:~ $ sudo su
root@raspberry:~# nano /etc/apache2/apache2.conf


          <Directory />
          ...
          AllowOverride None
          ...
          </Directory>
          

Alter and put additional code like below.


          <Directory />
          ...
          AllowOverride FileInfo
          ...
          ErrorDocument 403 /path_to/403.html
          ErrorDocument 404 /path_to/404.html
          ...
          </Directory>
          

Skip the /path_to if the document(s) is(are) in /root placed.


Save Crtl O the file apache2.conf and close Crtl X the nano editor.


A restart is needed :


root@raspberry:~# systemctl restart apache2


For the solution with using a generally accepted /.htaccess file correctly in /root placed.


This article describes the most comfortable and comprehensive way.

Read the next chapter : //dosboot.org/contents/setup-apache2-server-htaccess.html.


03-Jul 2017
Updated 10-Feb 2021


Custom 403 error message easily made


A good idea has to let the visitor knowing what occured exactly.

Not every HTML-tag is permitted like the CSS style tags. HTML5 code rules out totally.


Watch out the quotation marks with "<html> and </html>".


root@raspberry:# nano /var/www/html/.htaccess


REMOVE ALL LINE BREAKS or you will get the »500 Internal Server Error«.


        ErrorDocument 403 "<html>
        <head>
        <title>403 Access Forbidden</title>
        </head>
        <body>
        <br><hr><h2>403 Access Forbidden</h2>
        <p>You don't have permission to access this resource.</p>
        <p>There are at least seven possible reasons :</p>
        <p>
        <ul>
        <li>Are you using an outdated web browser? <br>Upgrade your 
        web browser to the most recent version to improve the surf experience.</li>
        <br><li>A blank User-Agent string.</li>
        <li>Index file browsing is forbidden.</li>
        <li>A firewall denies the permission.</li>
        <li>The server's geotargeting feature does not allow any access.</li>
        <li>You are not a human being, you are an unwished web-robot.</li>
        <li>You come from a remote host rejected by the server configuration.</li>
        </ul>
        </p><br>
        <p>Example.Com apologizes for any inconvenience.
        <br>Goodbye and better luck next time :)<br>
        <br>Website administrator and domain owner</p>
        <hr>
        </body>
        </html>"
        

Source dosboot.org : Custom 403 error message easily made.


08-Feb 2021

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