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

Cubieboard and 2.00mm vs 2.54mm pins

Cubieboard has thickness 2.00mm 2×20-pin-header that is not so suitable for home hobbiest. Arduino and other small boards uses 2.54mm pin (0.100inch) To connect it I have bought 2.00mm to 2.54mm 40pcs Wire Cable 2P[…]

Continue reading ...

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