|
| 1 | +EWF Deployment |
| 2 | +============== |
| 3 | + |
| 4 | +##Apache on Windows |
| 5 | +###Apache Install |
| 6 | + |
| 7 | + - Check the correct version (Win 32 or Win64) |
| 8 | + - Apache Version: Apache 2.4.4 |
| 9 | + - Windows: http://www.apachelounge.com/download/ |
| 10 | + |
| 11 | +###Deploying EWF CGI |
| 12 | + |
| 13 | +####CGI overview |
| 14 | +> A new process is started for each HTTP request. So if there are N request to the same CGI |
| 15 | +> program, the code of the CGI program is loaded into memory N times. |
| 16 | +> When a CGI program finished handling a request, the program terminates |
| 17 | +
|
| 18 | +1. Build EWF application. |
| 19 | + |
| 20 | + ``` |
| 21 | + ec -config app.ecf -target app_cgi -finalize -c_compile -project_path . |
| 22 | + Note: change app.ecf and target app_cgi based on your own configuration. |
| 23 | + ``` |
| 24 | +2. Copy the generated exe file and the www content. |
| 25 | +
|
| 26 | + ``` |
| 27 | + Copy the app.exe and the folder www into a folder served by apache2, for example under |
| 28 | + <APACHE_PATH>/htdocs |
| 29 | + <APACHE_PATH> = path to your apache installation |
| 30 | + Edit httpd.conf under c:/<APACHE_PATH>/conf |
| 31 | + DocumentRoot "c:/<APACHE_PATH>/htdocs" |
| 32 | + <Directory "c:/<APACHE_PATH>/htdocs"> |
| 33 | + AllowOverride All -- |
| 34 | + Require all granted -- this is required in Apache 2.4.4 |
| 35 | + </Directory> |
| 36 | + ``` |
| 37 | +
|
| 38 | +3. Check that you have the following modules enabled. |
| 39 | +
|
| 40 | + ``` |
| 41 | + LoadModule cgi_module modules/mod_cgi.so |
| 42 | + LoadModule rewrite_module modules/mod_rewrite.so |
| 43 | + ``` |
| 44 | +
|
| 45 | +*Tip:* |
| 46 | +To check the syntax of your httpd.conf file. From command line run the following. |
| 47 | + |
| 48 | + ``` |
| 49 | + $>httpd - t |
| 50 | + ``` |
| 51 | +####.htaccess CGI |
| 52 | +http://perishablepress.com/stupid-htaccess-trics/ |
| 53 | +
|
| 54 | +``` |
| 55 | + Options +ExecCGI +Includes +FollowSymLinks -Indexes |
| 56 | + AddHandler cgi-script exe |
| 57 | + <IfModule mod_rewrite.c> |
| 58 | + RewriteEngine on |
| 59 | + RewriteRule ^$ $service [L] |
| 60 | + RewriteCond %{REQUEST_FILENAME} !-f |
| 61 | + RewriteCond %{REQUEST_FILENAME} !-d |
| 62 | + RewriteCond %{REQUEST_URI} !$service |
| 63 | + RewriteRule ^(.*)$ $service/$1 |
| 64 | + RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] |
| 65 | + </IfModule |
| 66 | +``` |
| 67 | +Replace $service with the name of your executable service, for example app_service.exe |
| 68 | +
|
| 69 | +
|
| 70 | +##Deploying EWF FCGI |
| 71 | +
|
| 72 | + - To deploy FCGI you will need to download the mod_fcgi module. |
| 73 | + - You can get it from here http://www.apachelounge.com/download/ |
| 74 | +
|
| 75 | +###FCGI overview |
| 76 | +> FastCGI allows a single, long-running process to handle more than one user request while keeping close to |
| 77 | +> the CGI programming model, retaining the simplicity while eliminating the overhead of creating a new |
| 78 | +> process for each request. Unlike converting an application to a web server plug-in, FastCGI applications |
| 79 | +> remain independent of the web server. |
| 80 | +
|
| 81 | +1. Build EWF application |
| 82 | +
|
| 83 | + ``` |
| 84 | + ec -config app.ecf -target app_fcgi -finalize -c_compile -project_path . |
| 85 | + Note: change app.ecf and target app_fcgi based on your own configuration. |
| 86 | + ``` |
| 87 | +2. Copy the generated exe file and the www content |
| 88 | +
|
| 89 | + ``` |
| 90 | + Copy the app.exe and the folder "www" into a folder served by apache2, for example under |
| 91 | + <APACHE_PATH>/htdocs. |
| 92 | + <APACHE_PATH> = path to your apache installation |
| 93 | + Edit httpd.conf under c:/<APACHE_PATH>/conf |
| 94 | + |
| 95 | + DocumentRoot "c:/<APACHE_PATH>/htdocs" |
| 96 | + <Directory "c:/<APACHE_PATH>/htdocs"> |
| 97 | + AllowOverride All -- |
| 98 | + Require all granted -- this is required in Apache 2.4.4 |
| 99 | + </Directory> |
| 100 | + ``` |
| 101 | +Check that you have the following modules enabled. |
| 102 | +
|
| 103 | + ``` |
| 104 | + LoadModule rewrite_module modules/mod_rewrite.so |
| 105 | + LoadModule fcgid_module modules/mod_fcgid.so |
| 106 | + ``` |
| 107 | +
|
| 108 | +By default Apache does not comes with fcgid module, so you will need to |
| 109 | +download it, and put the module under Apache2/modules |
| 110 | +
|
| 111 | +####.htaccess FCGI |
| 112 | +http://perishablepress.com/stupid-htaccess-tricks/ |
| 113 | +
|
| 114 | +``` |
| 115 | + Options +ExecCGI +Includes +FollowSymLinks -Indexes |
| 116 | + <IfModule mod_fcgid.c> |
| 117 | + AddHandler fcgid-script .ews |
| 118 | + FcgidWrapper $FULL_PATH/$service .ews |
| 119 | + </IfModule> |
| 120 | + <IfModule mod_rewrite.c> |
| 121 | + RewriteEngine on |
| 122 | + RewriteBase / |
| 123 | + RewriteRule ^$ service.ews [L] |
| 124 | + RewriteCond %{REQUEST_FILENAME} !-f |
| 125 | + RewriteCond %{REQUEST_FILENAME} !-d |
| 126 | + RewriteCond %{REQUEST_URI} !=/favicon.ico |
| 127 | + RewriteCond %{REQUEST_URI} !service.ews |
| 128 | + RewriteRule ^(.*)$ service.ews/$1 RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] |
| 129 | + </IfModule> |
| 130 | +``` |
| 131 | +Replace $service with the name of your executable $service, for example app_service.exe |
| 132 | +You will need to create an service.ews file, this file will be located at the same place where you |
| 133 | +copy your app service executable. |
0 commit comments