Tag Archives: apache

Setup a backup job for your LAMP sites. | Setup a backup job for your LAMP sites.

I wrote a script which takes a backup of my webserver, taking a snapshot of all the website content, database, and configuration files.

Theory is if the webserver died, we would be about to result quickly using the data backed up.

On the server, put the following script and below is the cron entry which triggers every week. You will need up change the username and password for your mysql server.

This is the cron entry which fires up every friday.

Now this script will be on a linux machine somewhere else, it will connect and copy the backup archive file generated. You must first setup the ssh key so that its passwordless connection.

Simplicity it key! It works and will get you out of trouble. Well worth the 5minute investment.

 

 

Apache Load Balancer and reverse proxy howto | Apache2 load balancer reverse proxy howto

I wasted alot of time trying to figure out how to use Apache as a reverse proxy to load balance two of my web servers.

I thought I would write a little howto on how to get this up and running quickly.

I know used this setup with docker, using two containers running a standard installation of Apache and the other running Apache with the below configuration (Load Balancer)

Lets get started

The following commands will install all the required software using apt and aptitude.

Run the following to install all the required Apache modules.

Now we need up edit the following Apache configuration file.

This is what the configuration file should look like, please change the IPs and ports of the webservers your proxying.

Restart Apache and your ready to rock and roll!

 

Howto open ports into your Docker containers | docker ubuntu how to open ports in containters

I’m playing around with docker containers, I just wanted to build a docker container and run a service on it which will be accessible externally.

Lets start by getting a fresh ubuntu image from the repos.

Lets see what images are now available, you should see the latest download in the list.

You see this. We’ll pick the newest one.

Now this is how we select the image and open the ports, see the “-p” switches? This will open SSH (22) and Web (80).

This will build the container, once your at the logon prompt you will need to install the services, ie

This will update apt and install apache and ssh

This will start the services.

This will enable the services to start at startup.

Now the container is setup we can exit out.

Once we have exited we’ll start the container.

Now we need to find out if the container is running, and if its running which random ports its assigned to our services.

That command will display the following.

Now the above output tells us the container is running and it has assigned ports to out services. So if you put up the webbrowser on your computer and put the hosts IP in like this,

Now you should see the apache test page.

or is you want to ssh into the container enter this command

Just name sure you setup a user account on the container first.

Building a weather station Raspberry Pi 3 IOT | Raspberry Pi 3 weather station weewx IOT

I wanted to build a weather station located at my holiday house, functional reasons were to know when it hasn’t rained in a while so I knew if the garden needs watering.

The nerd in me just wants everything to be network enabled.

The components I used,

  1.  Acurite Pro 5-in-1 Color Weather Station with Wind and Rain
  2. Raspberry Pi 3

The setup was very simple and quick to set up!

Lets get started!

After installing the weather station somewhere around your house and switching on the base station. You should now be able to see the weather at the base station, information such as rain, temp, humidity etc should be flowing.

Now connect the base station to the raspberry pi via the USB cable.

SSH onto the raspberry pi, to check if we have connectivity do the following.

When you see the device we have connectivity.

Bus 001 Device 005: ID 24c0:0003

How to configure the server and install the software, in this setup we’ll be using weewx for our communication with the weather station and data gathering.

Then navigate to the raspberry pi IP address through your web browser.

http://192.168.1.1/weewx