Apache+PHP on Cubieboard with Lubuntu

I executed the following steps to install apache with PHP on my cubieboard2 with lubuntu.

Lets start with installation that will take about 25MB:

sudo apt-get install apache2
sudo apt-get install php5
sudo /etc/init.d/apache2 restart

Put your IP address to the browser (or localhost) and you see that Apache was installed correctly.

Your www content is stored in /var/www.

The whole www folder is owned by root. So for easier access I changed owner to my user named linaro

sudo chown -R linaro /var/www

To test PHP create a new php file in www directory:

 echo "<?php phpinfo(); ?>" > /var/www/info.php

And final test of php in apache from the browser.

We are done.

No you can continue with adding sata hdd drive or settip up media server (or both). You can try to attach some hobby devices via serial (UART) or I2C communication.

Hints

Security

Apache is running under root user that is not so secure. Read the hints how to secure you web server.

If I wanted also MySQL I would go for LAMP that you can install with sudo apt-get install lamp-server.

If you installed only apache+php then to install mySQL later (85MB):

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

Follow this ubuntu guide

Logrotate

To rotate log files follow the following sites:

I have changed apache log files to be stored in /tmp/ and I will keep only 1 day history. Mine logrotate config file looks like this:

cat /etc/logrotate.d/apache2
/tmp/*.log /var/log/apache2/*.log {
        daily
        missingok
        rotate 1
        compress
        delaycompress
        notifempty
        create 640 root adm
        sharedscripts
        postrotate
                if /etc/init.d/apache2 status > /dev/null ; then \
                    /etc/init.d/apache2 reload > /dev/null; \
                fi;
        endscript
        prerotate
                if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
                        run-parts /etc/logrotate.d/httpd-prerotate; \
                fi; \
        endscript
}

To check logrotate status: cat /var/lib/logrotate/status
To rum and check logrotate execution: logrotate -d -f /etc/logrotate.conf
-d = Turns on debug mode. In debug mode, no changes will be made to the logs or to the logrotate state file.


Related Posts

Upgrade Ubuntu 12.10 (Linaro 13.04) to Ubuntu 13.10 (Linaro 14.01) and later to Ubuntu 14.04 LTS

I wanted to keep my existing configuration and programs on my Cubieboard2 with Linaro Lubuntu, but at the same I wanted to upgrade the packages since the Lubuntu 12.10 is quite outdated. This post describes[…]

Continue reading ...

Lubuntu ssh: Read from socket failed – solved

SSH to my fresh lubuntu on cubieboard2 was not working. I tried it also from the lubuntu itself with the error: $ ssh localhostRead from socket failed: Connection reset by peer I went through many[…]

Continue reading ...

Kippo honeypot on Cubieboard Ubuntu

Kippo is an SSH honeypot written in Python. Kippo is used to log brute force attacks and the entire shell interaction performed by an attacker so I have installed it on my cubieboard2 Lubuntu version.[…]

Continue reading ...