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

Lubuntu – installing VNC server

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 ...

Cubieboard2 – Lubuntu – Xterm Copy/Paste

As you can find out the normal copy paste is not working in Lubuntu Xterm.This blog: http://www.davidsimmons.com/soft/xtermhacks/ looks to me too complicated. I just have to get used to my mid mouse button that will copy+paste the[…]

Continue reading ...

Cubieboard with BMP085 Barometer, Alittute, Temperature

I’ve bought  BMP085 barometric pressure sensor and my goal was to get pressure and temperature data via I2C interface to my Cubieboard running linux (cubieboard2-lubuntu-installation).

Continue reading ...