Setting up your First Webstore

Learn how to setup your first webstore and install your first subdomain

Introduction


This doc 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


Before setting up your first webstore, you must have also read and completed the following docs:

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

Setting up the Subdomain


Before creating your webstore on the Control Panel. You need to point your sub domain to the server you are running the application on using an A Name record. Note that even if your domain is with a given provider, if your using Cloudflare, you will more than likely have to set the DNS records there

Once that is complete we need to make some changes to our Nginx config. You can open it with whatever editor you want, but this doc will show using vim:

vim /etc/nginx/sites-available/DonationStore

Once you run that command, it will open a configuration file that looks something like 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:8000;
                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 using proxy_set_header.

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

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

        location / {
                proxy_pass http://123.254.123.123:8000;
                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

Setting Allowed Hosts


When you open your store with your new sub domain you may see a BAD REQUEST 400 error. This is because Donation Store is blocking requests coming from that host. To prevent HTTP Host Header attacks, Donation Store maintains a list of allowed hosts. The setup script has already added the given IP address as an "Allowed Host", however you will have to add your sub domain.

To do so, simply open the settings file at /home/donationstore/env/DonationStoreV2/settings.py and at the top you will see ALLOWED HOSTS. Simply replace the IP with your subdomain.

ALLOWED_HOSTS = ['store.donationstore.io']

Once changed, you will have to restart Donation Store

service donationstore restart

Multiple Webstores


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! Like the allowed hosts above, you will also have to add that new sub domain as an allowed host. Like this

ALLOWED_HOSTS = ['store.donationstore.io', 'otherstore.donationstore.io']

Now that you have setup your first webstore, its time to install the plugin on your server.


Have Questions? Open a Support Ticket

View Common Issues on the Knowledgebase

Video Guides on YouTube

Other clients and Donation Store developers hang out on our Discord server, where you can ask for support in #ds-chat, or if you are a Client and you don't uet have your Client role on Discord, let us know and we can add it. Once added you get access to our private Client's support channel.