by Rosco under | 0 comments

Use the CloudVPS Object Store as Storage Backend for Apache2

The CloudVPS Object Store makes it easy to store static data (like pictures or documents) of a website. In this article we explain how you can easily link files stored in the object store to your website using Apache2.

The advantage of the CloudVPS Object Store is that the VPS itself does not need a lot of harddisk space. Within the object store there is a practically unlimited amount of storage available to store files. Your data is stored in multiple datacenters and you only pay for what you use. Files can easily be added to the object store using FTP thanks to our FTP To Object Store functionality.

Howto use an object Store as storage backend for Apache2

Create a container in the object store, for example:


This can be done via the interface or via the CloudVPS FTP Proxy with your FTP program of choice.

Put this container in the CloudVPS Interface to 'public' so your webserver can reach it. Do not put sensitive data in this container because it is publicly accessible.

Next you can upload your static files like pictures or documents to this container with your FTP program or via the API of the object store.

The object store is now ready for use. Remember the projectid of your object store and the container name.


We now continue on a VPS with Ubuntu 12.04 (or a later version)

Below we provide an installation example for a fresh Ubuntu 12.04.4 LTS installation.

Install Apache2 and the corresponding modules.

 apt-get install apache2 libapache2-mod-proxy-html -y

Activate the Apache2 modules:

 a2enmod proxy
 a2enmod proxy-http

Restart Apache2:

 /etc/init.d/apache2 restart

Now add the below text to your virtualhost file (see below for a complete example of the virtualhost file):

 <IfModule proxy_module>
 <IfModule proxy_http_module>

  ProxyPass /images/ http://<projectid>.objectstore.eu/images/


The <IfModule proxy_module> and <IfModule proxy_http_module> ensure that the Apache2 configuration in the middle only works when this module is active.

The ProxyPass rule tells Apache2 that all visitors to http://www.example.net/images/ are routed to http://<projectid>.objectstore.eu/images/

Below a complete example for: /etc/apache2/sites-available/www.example.net Change www.example.net to your own domain.

 <VirtualHost *:80>
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www
  ServerName www.example.net

  <Directory />
   Options FollowSymLinks
   AllowOverride None

  <Directory /var/www/>
   Options Indexes FollowSymLinks MultiViews
   AllowOverride None
   Order allow,deny
   allow from all

  <IfModule proxy_module>
  <IfModule proxy_http_module>

   ProxyPass /img/ http://0a0e54183b0b42e595f1bb77ab903c64.objectstore.eu/objecstore-images/


  ErrorLog ${APACHE_LOG_DIR}/error.log
  LogLevel warn
  CustomLog ${APACHE_LOG_DIR}/access.log combined


Reload Apache2 with:

 /etc/init.d/apache2 reload

Now direct the A record of your domain (in this example: www.example.net) to the IP address of your VPS.

The uploads via FTP are now visible under: http://www.example.net/images/plaatje.jpg

Source: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Comments (0)

Leave a comment

Commenting is not available in this channel entry.
VPS Bestellen
VPS Bestellen