Changes

Jump to navigation Jump to search
added configuration of apache + reverse proxy
Line 105: Line 105:     
=== Apache 2.2 + mod_perl: Product Opener backend ===
 
=== Apache 2.2 + mod_perl: Product Opener backend ===
 +
 +
==== Build ====
    
<pre>
 
<pre>
Line 125: Line 127:  
make
 
make
 
make install
 
make install
 +
</pre>
 +
 +
==== Configuration ====
 +
 +
In apache/conf/httpd.conf:
 +
 +
Change the port to something else than 80 (the reverse proxy will listen on 80 and forward to the backend on another port).
 +
 +
<pre>
 +
Listen 8001
 +
</pre>
 +
 +
If you are installing several Product Openers on the same machine, use different ports.
 +
 +
Change the Apache user to your user:
 +
 +
<pre>
 +
User stephane
 +
Group stephane
 +
</pre>
 +
 +
Add to apache/conf/httpd.conf:
 +
 +
<pre>
 +
LoadModule perl_module modules/mod_perl.so
 +
 +
PerlWarn Off
 +
PerlRequire /home/stephane/product-opener/cgi/startup.pl
 +
 +
 +
<Location /cgi>
 +
SetHandler perl-script
 +
PerlResponseHandler ModPerl::Registry
 +
PerlOptions +ParseHeaders
 +
Options +ExecCGI
 +
Order allow,deny
 +
Allow from all
 +
</Location>
 +
 +
 +
<VirtualHost *>
 +
DocumentRoot /home/stephane/product-opener/html
 +
ServerName openfoodfacts.ovh
 +
ErrorLog /home/stephane/logs/error_log
 +
CustomLog /home/stephane/logs/access_log combined
 +
ScriptAlias /cgi/ "/home/stephane/product-opener/cgi/"
 +
</VirtualHost>
 +
 +
PerlPostReadRequestHandler My::ProxyRemoteAddr
 
</pre>
 
</pre>
       
=== Apache 2.4 - light weight reverse proxy ===
 
=== Apache 2.4 - light weight reverse proxy ===
 +
 +
==== Build ====
    
<pre>
 
<pre>
Line 153: Line 206:  
</pre>
 
</pre>
    +
==== Configuration ====
    
in proxy/conf/httpd.conf :
 
in proxy/conf/httpd.conf :
    uncomment #LoadModule rewrite_module modules/mod_rewrite.so
+
* uncomment #LoadModule rewrite_module modules/mod_rewrite.so
    uncomment #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
+
* uncomment #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
   −
Add:
+
Add in httpd.conf :
    +
<pre>
 +
<VirtualHost *>
 +
DocumentRoot /home/stephane/product-opener/html
 +
ServerName world.openfoodfacts.ovh
 +
ServerAlias *.openfoodfacts.ovh
 +
 +
ErrorLog /home/stephane/logs/proxy_error_log
 +
CustomLog /home/stephane/logs/proxy_access_log combined
 +
ServerAdmin stephane@openfoodfacts.org
 +
 +
<Directory "/home/stephane/product-opener/html">
 +
    Options Indexes FollowSymLinks
 +
    Require all granted
 +
</Directory>
 +
ProxyPreserveHost On
 +
RewriteEngine on
 +
RewriteCond  %{REQUEST_URI}  !/./
 +
RewriteRule ^(/cgi/.*)$ http://localhost:8001$1 [P,L]
 +
RewriteMap escape int:escape
 +
RewriteRule ^/favicon.ico$ /favicon.ico [L]
 +
RewriteCond  %{REQUEST_URI}  !^/images/
 +
RewriteCond  %{REQUEST_URI}  !^/js/
 +
RewriteCond  %{REQUEST_URI}  !^/rss/
 +
RewriteCond  %{REQUEST_URI}  !^/robots
 +
RewriteCond  %{REQUEST_URI}  !^/clicks/
 +
RewriteCond  %{REQUEST_URI}  !^/data/
 +
RewriteCond  %{REQUEST_URI}  !^/files/
 +
RewriteRule  ^(.*)$ http://localhost:8001/cgi/display.pl?${escape:$1} [P,L,QSA]
 +
</VirtualHost>
 +
 +
 +
<VirtualHost *>
 +
DocumentRoot /home/stephane/product-opener/html
 +
ServerName openfoodfacts.ovh
 +
ErrorLog /home/stephane/logs/proxy_error_log
 +
CustomLog /home/stephane/logs/proxy_access_log combined
 +
DirectoryIndex index.html index.shtml
 +
<Directory "/home/stephane/product-opener/html">
 +
    Options -Indexes +FollowSymLinks +Includes
 +
    Require all granted
 +
</Directory>
 +
RewriteEngine on
 +
RewriteCond %{HTTP_HOST} ^stephane\.openfoodfacts\.ovh
 +
RewriteRule ^/products$ /products.shtml [L]
 +
 +
</VirtualHost>
 +
 +
</pre>
     

Navigation menu