Apex application through Apache 2 proxy server on Backtrack 5
To start Apache 2:
/etc/init.d/apache2 start
Default, web document path:
/var/www
Your domain www.mydomain.com
Oracle XE comes with the embedded plsql gateway (in the database DBMS_EPG) and the "usual" HTML DB installation uses an Oracle Apache with mod_plsql.
I would suggest using your Apache as a proxy to your XE installation.
I would suggest using your Apache as a proxy to your XE installation.
/etc/apache2/httpd.conf
This is a pretty basic Apache feature – first you will need to load the required modules:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule rewrite_module modules/mod_rewrite.so
Let’s assume that I want to access a file at http://apexdomain.com/apex/f?p=... You would put all of the following into a :
# start mod_rewrite
RewriteEngine On
ProxyRequests Off
Order deny,allow
Allow from all
ProxyPass /sample/ http://apexdomain.com/apex/
ProxyPassReverse /sample/ http://apexdomain.com/apex/
RewriteRule ^/sample/(.*)$ /apex/$1 [R]
ProxyPass /i http://apexdomain.com/i
ProxyPassReverse /i http://apexdomain.com/i
Restart Apache and make a browser request to http://mydomain/sample/f?p=101:1 and you should receive a response from the remote server athttp://apexdomain.com/apex/f?p=101:1. The RewriteRule will pass along any query-string parameters too.
Full content of httpd.conf file may look like this:
#-------------------httpd.conf content -----------
DocumentRoot /var/www
ProxyRequests Off
Order deny,allow
Allow from all
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_rewrite.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ServerName mydomain.com
ServerAlias myalias
RewriteEngine On
ProxyPass /samples/ http://apexdomain.com/apex
ProxyPassReverse /samples/ http://apexdomain.com/apex
RewriteRule ^/samples/(.*)$ /apex/$1 [R=301,L]
ProxyPass /i http://apexdomain.com/i
ProxyPassReverse /i http://apexdomain.com/i
#ProxyPass /sys http://apexdomain.com/sys
#ProxyPassReverse /sys http://apexdomain.com/sys
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
CacheEnable disk /
CacheRoot "/var/cache/mod_proxy"
#------end of doc--------
To restart Apache 2:
/etc/init.d/apache2 restart
If it gives error that proxy.so modules are not launched.
Enable mod_proxy
proxy.so
proxy_connect.so
proxy_http.so
How to check module if it is already available?
Module path :
ls -l /usr/lib/apache2/modules/mod_proxy.so
Module config path :
ls -l /etc/apache2/mods-available/proxy.load
How to Enable mod_proxy now?
a2enmod proxy
a2enmod proxy_connect
a2enmod proxy_http
Restart Apache
/etc/init.d/apache2 restart
Test you application, all URLs that is rewritten should work now!
If you get following error:
Forbidden
You don't have permission to access /samples on this server.
Apache/2.2.14 (Ubuntu) Server at My IP Port 80
Check out the logs.
vi /var/log/apache2/error.log
If you have sort of this error:
[error] [client IP] client denied by server configuration: proxy:http://apexdomain/apex/ Client denied by server configuration error in Apache
The solution might be to edit
The solution might be to edit:
vi /etc/apache2/mods-available/proxy.conf
and change it as:
AddDefaultCharset off
Order deny,allow
#Deny from all
Allow from all #.example.com
Now, restart apache:
/etc/init.d/apache2 restart
If following error appears:
[warn] NameVirtualHost *:80 has no VirtualHosts
do following;
# a2dissite default
Restart Apache, and if you still get:
"[warn] NameVirtualHost *:80 has no VirtualHosts"
Then enable the 'default' site:
# a2ensite default
FYI. Apache's configuration is split in several files like:
httpd.conf, apache2.conf, ports.conf, conf.d/*., (conf.d/virtualhosts)
If you have following error, that means the path is not rewritten correct.
Bad Request
The HTTP client sent a request that this server could not understand.
You might not see graphics and get following error:
Flash Security Error
AnyChart can not be launched due to Flash Security Setting violation.
...
No comments:
Post a Comment