Skip to main content

OwnStaGram, build your own instagram server

Instagram is probably the most popular photo sharing app allowing you to easily share all your photos to your friends and family. However the TOS have changed quite a lot and you may fear some security, anonymity and ownership concerns to share all your life to this company.

If this the case, few alternatives exists with a strong focus on privacy or even allowing you to run your own instance of Instagram-like on your server to keep full ownership of your pictures. And this is what OwnStaGram is providing.

ownstagram screenshot

OwnStaGram is a self-hosted photo sharing-platform, written in PHP and under GPLv3 license. It allows you to upload your pictures to the website or directly with a dedicated Android app, then you can simply share the URL of your pictures to your friends, family, etc…
You can have a look here as an example.


You will need to have a working LAMP server. If it is not the case, please follow this article.

1) Clone the git repository under your /var/www folder

2) Make sure ownstagram folder is writable

3) Create a database

You can use phpmyadmin to do so (Or adminer)

I called it ownstagram and created a dedicated user (ownstagram)

4) Import/run the SQL-File “DATABASE.sql

If you use phpmyadmin, the easiest is to copy the content of the DATABASE.sql to ownstagram–>SQL and run the code.

5) Configure the inc.var.php file

You will need to rename the inc.var.php.dist into inc.var.php

and insert your database credentials into your inc.var.php

and set the host (localhost probably), user, pass and name.

You will also need to modify the “ownStaGramAdmin” with the email address you want to use as admin user.

Note that you can also set the MailSender, site name and timezone.

When done, simply save the file with CTRL +X (then Y)

6) Register with the admin email address previously created

Simply go to http://yourip/ownstagram and register your admin user, previously set into your inc.var.php file.

ownstagram register

When done, it will recognize the admin account and will skip the activation step.

You are now ready to upload photos, add users, create groups, etc… but also to install the android app and to point it to your ownstagram instance.

ownstagram android mobile app screenshot


And if you want to have a more friendly URL, like mygram.domain.tld or even to set up SSL connection, follow below instructions


Virtualhost configuration

What you will need:

1) Create a A redirection in your DNS server/registrar with mygram.domain.tld to your IP

2) Have SSL certificate ready. If not you can read this tutorial. (Optional)

3) Create your virtualhost as following:

In /etc/apache2/sites-enabled/, create a file called ownstagram (In root):

and paste the following content:

Adapt the content (Servername, webmaster, SSL certificate and directory).

When done, save the file (CTRL+X then Yes) and reload apache: (In root)

Now your ownstagram should be fully working will SSL certificate and using a easier to remember URL.

instagram funny comics xkcd

Leave a Reply

Your email address will not be published. Required fields are marked *