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

DLNA media server on Cubieboard with Lubuntu

DLNA_logo

I have installed Lubuntu on my new Cubieboard 2. I have also attached HDD to SATA so I have more space to store my media. This posts describes the steps needed to install and configure[…]

Continue reading ...

Enable UART on Cubieboard with Lubuntu

UART

I wanted to connect my cubieboard with lubuntu to my arduino via serial communication. For that I had to enable a UART and connect pins to my arduino (only RX/TX is needed). I have arduino[…]

Continue reading ...

Lubuntu – installing VNC server

vnc

I use vnc to access graphic interface from my PC to cubieboard that runs on lubuntu. I have chosen tightvncserver and spent some time to configure and run it. Also to my surprise it took me[…]

Continue reading ...