Complete the setup - KL-Psychological-Methodology/ESMira GitHub Wiki

Complete the setup

Then, start your web browser and open the admin interface (e.g. https://example.com?admin). The page should look like this:

ESMira

Note

In order to use the admin interface, make sure that your browser is up-to-date and has JavaScript enabled. You should also have Cookies enabled or auto log in will not work.

Follow the instructions and provide a data path, username and password. Make sure that the password is secure because this account will be able to view, change and delete all studies and data on your ESMira server!

Caution

Make sure to remember your admin password. There is no (easy) way to retrieve it afterward!

Your own ESMira server should now be set up successfully!

If you run into any problems, have a look at Common problems. If that does not help, the discussion forum can help you. Next, you should read Conditions for using ESMira and The admin interface.

Optional steps for specific server setups

Note

If you are using Docker, this will not be necessary.

The following instructions are only necessary if you get warned on the initialization page that your server does not support URL rewrite (notably .htaccess files and / or the mod_replace feature of apache server).

Why do I need this?

Most features of ESMira will work without URL rewrite except for two things:

  • Making sure that the data folder is not accessible from the internet.

Caution

Without .htaccess support (or alternatives) you need to make sure that the "esmira_data" directory is at a location that can not be accessed from the internet or all your study data will be easily accessible to everybody!

Enabling URL rewrite is different on different server architectures. Please follow the instructions according to your server:

Apache server

Enable htaccess support

In order to enable .htaccess support, you need to change /etc/apache2/sites-available/default (depending on your setup, you might have to change the vhost file that is responsible for ESMira).

Locate the section labeled <Directory /var/www> (/var/www might be different depending on your server setup). Add a new line somewhere between the <Directory> tags with the content:

AllowOverride All

Then restart apache2 by running in the console (you need to run this command with root privileges):

service apache2 restart

Enable mod_rewrite

(needed to make short links to studies work)

Run the following command in your console (you need to run this command with root privileges):

a2enmod rewrite

Then restart apache2 by running (with root privileges):

service apache2 restart

Nginx server

(this section has only partly been tested and probably can be improved - we would be happy to receive feedback :) ).

In your vhost configuration in /etc/nginx/sites-available/000-default (depending on your setup, you might have to change the vhost file that is responsible for ESMira) add the following lines in the server { section:

# to a study
location / {
	# www.example.com/1234
	if ($request_uri ~ "\d$"){
		rewrite ^/(\d+)$ /index.php?id=$1 last;
	}
	
	# www.example.com/KEY
	rewrite ^/([a-zA-Z][a-zA-Z0-9]+)$ /index.php?key=$1 last;
	
	# www.example.com/1234-KEY
	rewrite ^/(\d+)-([a-zA-Z][a-zA-Z0-9]+)$ /index.php?id=$1&key=$2 last;
}

#to app instructions
location /app {
	# www.example.com/app-1234
	rewrite ^/app-(\d+)$ /index.php?id=$1&app_install last;
	
	# www.example.com/app-KEY
	rewrite ^/app-([a-zA-Z][a-zA-Z0-9]+)$ /index.php?key=$1&app_install last;
	
	# www.example.com/app-1234-KEY
	rewrite ^/app-(\d+)-([a-zA-Z][a-zA-Z0-9]+)$ /index.php?id=$1&key=$2&app_install last;
}

# to questionnaire
location /survey {
	# www.example.com/survey-12345
	rewrite ^/survey-(\d+)$ /index.php?qid=$1 last;
	
	# www.example.com/survey-12345-KEY
	rewrite ^/survey-(\d+)-([a-zA-Z][a-zA-Z0-9]+)$ /index.php?qid=$1&key=$2 last;
}


location /api {
	# Needed for uploading big files (i.e. photo or voice_input item):
	client_max_body_size 0;
    
	# Fallback in case we ever want to replace the php backend:
	rewrite ^/api/([^.]+)$ /api/$1.php last;
}

# Deny access to backend files and esmira_data
location ~ /(backend|esmira_data) {
	deny all;
	return 404;
}

Any other server

Please open an issue, and we will try to figure it out together. If you were able to set up ESMira without or help please provide us with your settings, so we can add them to the wiki! :)

⚠️ **GitHub.com Fallback** ⚠️