Setup Your First Webstore

Learn how to Setup your First Webstore

This guide will cover how to setup your first webstore. As of v2.2, Donation Store manages sub domains itself, however your Nginx config will require just a single line to enable this.


Requirements

You must have followed the following docs before continuing:

  • Installing the Application
  • Setting up a Database

You must also have ran the installer found at http://yourIP/install


Continuing from the Install Guide

In the install guide, you ran the setup script which asked you for your server's IP address. Not only will subdomains not work on this, but we don't think server owners want their server's webstore running on an IP. So to configure this we need to make a few changes to our Nginx config.

To open the Nginx config, simply run:

nano /etc/nginx/sites-available/DonationStore

You will probably see something similar to this:

server {
        server_name 123.254.123.123;
        access_log off;

        location /static {
                alias /home/donationstore/env/static;
        }

        location / {
                proxy_pass http://123.254.123.123:8001;
                proxy_set_header X-Forwarded-Host $server_name;
                proxy_set_header X-Real-Ip $remote_addr;
                add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
        }
}

You need to change your server name to be the domain our subdomain you are pointing from. In this example we will use a subdomain, for example a game server network. This subdomain will also be added in the control panel when creating your webstore.

The result should look like this (with the server_name changed) and the Host header added to be passed on each request.

server {
        server_name store.donationstore.io;
        access_log off;

        location /static {
                alias /home/donationstore/env/static;
        }

        location / {
                proxy_pass http://123.254.123.123:8001;
                proxy_set_header X-Forwarded-Host $server_name;
	        proxy_set_header Host $server_name;
                proxy_set_header X-Real-Ip $remote_addr;
                add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
        }
}

Give Nginx and Donation Store a restart to make sure the changes come into effect:

service nginx restart
service donationstore restart

Now when you are creating a webstore, simply put what you placed beside server_name in the subdomain field. So for the above example, when we are asked for a subdomain when creating the webstore, we put:

store.donationstore.io


Some Notes

If your planning on having more than one webstore per subdomain, you will have to have multiple server blocks in your Nginx config. To do so, just copy the above server block and paste it below it. Then just change the subdomain information!