Tag Archives: apache2

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.

 

 

Fix Apache2 SELINUX permissions problems. | selinux stopping images appearing on site

I recently had a request with an Apache2 problem.  The website didn’t display the images on the page.

After looking at the logs, the error appeared in the /var/log/audit/audit.log.

When you kick off a request with the web browser, you see 5 – 6 error appear about permissions.

So fix this, its easy, running the following command while its running refresh your browser.

This tool will find the error and create a white list and store it as “test”

To implement the fix execute the following command.

Once completed you will have access to your files.

How to enable SEO URLs on Opencart | how to enable SEO urls on opencart

Having SEO friendly urls is vital for google page rank.

Surprisingly it wasn’t the most straight forward process, so I created a howto for people using opencart.

Start by renaming the .htaccess file located in the Opencart root directory, its already setup and ready to go.

Then you need to enable in apache2.

and ensure the following is inserted. under your <VirtualHost *:80> section.

 

Setting up nextcloud on a Raspberry Pi 1 | how to setup nextcloud on a raspberry pi

A quick and easy way to setup the a Raspberry Pi 1 with Nextcloud.

Nextcloud is an awesome solution for your personal cloud requirements. If will provide you with the following solutions.

  • Data storage accessible via an App or Webgui
  • Share your data with the internet, based on your permissions
  • Store and play music
  • Store and share contacts and calendars
  • Backup and sync with your phone or tablet
  • and many more

Lets gets started, lets install the dependencies.

Download Nextcloud from their site.

Create the data directory and set permissions.

Restart apache

Boom, your done. Point your browser to nextcloud and start to customize.

Installing and configuring MediaWiki on Raspberry Pi 1 | Setup mediawiki on a raspberry pi 1

MediaWiki is the software used by Wikipedia run, its a fantastic way to document share.

I would recommend installing DNSMasq to allow as to use fully qualified domain names. See here.

Setting up Mediawiki is a pretty simply task, does not really require a high level of experience. Lets dig in, install software.

Once completed we start setting up the housing for MediaWiki, the following will also download the software from MediaWiki’s site and unzip it.

Then we’ll need to setup the database and user permissions.

Now we’ll begin the Mediawiki installation, easy part. Navigate to the following URL and start the point and click install.

Once connected you’ll see this.

Click on the “Set up the wiki” link, follow the instructions and enter all the information it requires. Take note, youll need the database,username and password we input earlier. Once it has finished it will let you download the LocalSettings.php file to your computer. You’ll need to upload it to the /var/www/html/wiki directory.

Lets create the DNS entries.

Insert the following line

Now restart DNSMasq

We also need to setup the virtual host in apache

Insert the following line

Restart apache.

Make sure your connected to the AP while your setting up, otherwise the setup will use the LAN IP to setup the config file.

Enjoy!

Ubuntu installing and preparing Apache2 and PHP7 | how to install and setup apache2 and php on ubuntu

I spent a bit of time this morning setting up apache2 and php, things have changed in the newer versions of Linux.

The following will install apache and php.

This will test if PHP is install and running on the command line.

This will check if the PHP modules are loaded in apache.

Save the following file in the following location.

restart apache

in your web browser navigate to

You should see something like this.

 

 

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.