Raspberry Pi as web server

my first project is to turn my Raspberry into a small web server. For this I was to use the following things:

  • Apache2 as web server
  • PHP 5 as script language
  • MySQL as database
  • FTP Server


First we have to check if the user group for the web server exists:

Normally this step is not needed.

After that, we can install Apache with a packet manager:

Done. Now with localhost in our Browser on the Raspberry Pi we should se a message.


Php 5 can also be installed easily with the packet manager:

Thats all! But for a web server you may need some additional packets that works with PHP 5:


MySQL is a very popular database for web servers. I personally use PostgreSQL. You can install MySQL with the following command:

During installation the root password for the database is needed.
If you want to avoid problems, you should reboot you Raspberry now. I wanted to skip this step and got error messages like ‘packet mysql-server-5.5 is not yet configured’.


PHPMyAdmin is a smart web client for MySQL. It can be installed the following way:

Here we get a dialog where we use Apache2 as web server.

PhpMyAdmin also needs to create tables in your database. So there will be a dialog where it is asked if it is allowed to do that. We want this and we also need to set a new PhpMyAdmin password.


To get our program source code to the server we need a FTP connection. For this we install ProFTP.

During installation we choose ‘standalone’.


For our FTP server we don’t need real Unix users, but some virtual ones. For this we change the following file:

we add the following lines at the end:

Now we create a virtual User (for me the username is hansi):

Now you will be asked to set a password for the FTP user. This FTP user now has read and write permissions for your web server root directory. We only need to set some rights:

The last thing is to restart out FTP server daemon:

(Visited 1,886 times, 1 visits today)

3 Responses

  1. Kenny says:


    The configuration of ProFTP solved an issue I have had deleting files created by PHP using ftp.
    I’m using this small web server to test a gallery, and a few other tools I have made, under Linux. Perfect little server for that. I only also had to install php5-gd.

    Thanks a lot for the description.

    Best Regards

  2. David Kirichmer says:


    Really appreciate this guide and instructions.

    Having a problem when trying to run the PHPMyAdmin install.

    pi@my-Pi:~ $ sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadminReading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package libapache2-mod-auth-mysql is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘libapache2-mod-auth-mysql’ has no installation candidate

    Completely new to the RaspberryPi and not sure what to do next.

    Machine model: Raspberry Pi 3 Model B Rev 1.2
    Linux version 4.4.26-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #915 SMP Thu Oct 20 17:08:44 BST 2016

    Thank you,


Leave a Reply

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