====== Preparation Apache Webserver ======
**Tip:** If you changed the apache cofiguration the webserver has to be rebooted. Apache 2 can do this without interrupting all running connections (and surveys).
* A gentle reboot can be done via ''apache2ctl graceful'' -- but in this case the server is not reachable for a few seconds.
* It is more elegant to prove the configuration file and reload it:\\ ''apache2ctl -t''\\ ''/etc/init.d/apache2 reload''
===== Installation Directory =====
In ideal case the webserver displays the user/visitor only the things that he should see. Especially it is not possible to see "from outside" where the files are placed on the server.
So it is necessary to distinguish at the installation directory where it is placed intern (e.g. ///var/www/sosci///) and under which name it is called extern (e.g. //%%http://www.domain.tld/survey/%%//). There are at least two options that the directory is visible "from outside" via HTTP or HTTPS.:
* Option 1: Use a directory in the path for webfiles. Bon an Apache web server, the directory for web documents is usually named ///var/www// or ///var/www/html// (Linux), ///apache/htdocs// (Windows), ///webserver/documents// (Macintosh) or similar. The exact path may be found in the Apache configuration (httpd.conf or files imported into it).
* Option 2: In the Apache configuration, use the ''Alias'' statement to release any directory on the server. A corresponding statement in the file ''httpd.conf'' could look something like the following.
Alias /survey "C:/Daten/SoSci"
AllowOverride All
Options MultiViews
Order allow,deny
Allow from all
**Note:** The alias is only after a reboot or a reload of the configuaration available.
===== Access Controll =====
Users accessing the web server via HTTP "from outside" should be able to access the project directories, the directory ''admin/'', ''images/'' and so on -- but not the protected file storage or the configuration.
At the atndard configuaration apache checks if a file ''.htaccess'' is placed in a directory. Based on this file SoSci Survey can restrict the accesses. __If__ apache is configurated to ignore the ''.htaccess'' files the following addition ''httpd.conf'' on the file is needed.
Ofcourse the directory names (''C:/Daten/SoSci/'') have to be adjusted to de respective installation.
Order allow,deny
deny from all
Order allow,deny
deny from all
Order allow,deny
deny from all
===== Connections =====
Ideally several persons are accessing the survey server at the same time. Therefore it is necessary that several connections are possible at the same time - if all connections are occupied further user or also the project administrator do not get any response of the server and get an error message from the browser that the server is not reachable.
In addition, SoSci Survey is a large package that also requires a certain amount of memory and computing time. Therefore the maximum number of server processes is restricted.
If the server can be operated in ''worker'' mode, this allows more open connections with the same memory configuration. But therefore a conversion from PHP modul to CGI is necessary: [[http://www.debianroot.de/server/apache2-worker-php-fcgid-fastcgi-suexec-debian-lenny-1004.html|Apache2 Worker with PHP and fcgid (FastCGI)]]
For a web server with 1 GB (4 GB) of memory, the following Apache settings have proven effective for the ''prefork'' operating mode:
* ''MaxClients 40'' (50)\\ Allows up to 46 connections at the same time (
at oFb 2.0.00 all processors were also fully occupied with it, then a further increase costs only more memory). If there is more memory availablethe value can be higher. But be careful on a V-Server: Here the maximum memory is not automatically the one that is available (s. Script 3 below).
* ''MaxSpareServers 16'' (30)\\ Some unoccupied server processes allow a fast reaction. A higher value can relieve the web server under load and only costs some memory in inactive times.
* ''MaxRequestsPerChild 10000''\\ The processes get reloaded after a while (10.000 Zugriffen), to head off eventual memory leaks in PHP.
* ''KeepAlive On''\\ If a connection between browser and server remains open, images, CSS, JavaScript files, etc. can be retrieved without reconnecting. This improves the speed. But no more requests can be operated on the connection -- therefore this function should not be activaded if the server slots (''MaxClients'') are thight anyway.
* ''KeepAliveTimeout 1''\\ Important: After the page load (which should be completed in a few seconds), the connection is quickly released as long as the user completes the questionnaire.
===== Case Sensitivity =====
By default, an Apache on a Linux system distinguishes between capital and small letters for file names (case-sensitive). This can cause a problem if the link to the questionnaire is entered by hand and the participants do not note the capital and smal letters.
Here the apache module helps ''[[http://httpd.apache.org/docs/2.2/mod/mod_speling.html|mod_speling]]'', which apache2 includes by standard. It is activated by the common command:
(sudo) a2enmod speling
To be activatet on the server the module has also to be activated at the configuration. It makes sense to place the following commands in the '''' area you have created for SoSci Survey (see above).
CheckSpelling on
CheckCaseOnly on
''
The line ''CheckCaseOnly on'' is optional. It restricts the correction of typos to upper/lower case.
To activate the changes the configuration has to be reloaded.
sudo /etc/init.d/apache2 reload