ApacheRedirection
First method
The second method doesn't works for me, so I (Clash) use this :
In /etc/apache2/sites-enabled/000-default :
<VirtualHost *:80> ... # Force ssl RewriteEngine On RewriteCond %{SERVER_PORT} ^80$ RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L] ... </VirtualHost>
In /etc/apache2/sites-enabled/ssl (port 443) :
<VirtualHost *:443> ... # Allow port 4080 <Proxy http://localhost:4080> Allow from all </Proxy> # Redirection RewriteEngine On RewriteRule ^/mldonkey$ /mldonkey/ [R] RewriteRule ^/mldonkey/(.*) http://localhost:4080/$1 [P] ... </VirtualHost>
This way, you can use
https://serverName/mldonkey to access http://serverName:4080
If you want to use
http://serverName/mldonkey to access http://serverName:4080
simply write the above content of ssl in 000-default without the "# Force ssl" paragraph
Second method
I already posted this to the mldonkey-bugs list aeons ago ... works great and without modifications if locations should change. Just to make that point clear I left the old entry under my additions :)
# the following line was missing for me, so i thought why not add it, might help some other people too :) RewriteEngine on # Proxy requests for mldonkey, don't use ProxyPass directly, it just plain sucks # and this works great :) RewriteCond %{REQUEST_URI} /mldonkey/.* RewriteRule .'''/(.''') http://inside:4080/$1 [[P]] [[L]] # Rewrite the relative URI's mldonkey generates to use the /mldonkey/ prefix so the # above rewrite rule can catch it. RewriteCond %{HTTP_REFERER} .'''outside:4043/mldonkey.''' RewriteRule .'''/(.''') https://outside:4043/mldonkey/$1 [[R]]
I (mezcalero) prefer the following form, it is a bit shorter and more complete:
RewriteEngine on RewriteRule ^/mldonkey$ /mldonkey/ [[R,L]] RewriteRule ^/mldonkey/(.*)$ http://localhost:4080/$1 [[P,L]] RewriteCond %{HTTP_REFERER} ^https?://[[^/]]+/mldonkey/ RewriteRule ^/(.*)$ /mldonkey/$1 [[R,L]]
Old:
From Crazee_Canuck (+ aibanahamano):
RewriteEngine on RewriteLog rewrite.log RewriteLogLevel 9 ProxyRequests on RewriteRule /mldonkey http://localhost:4080/$1 [[P,L]] RewriteRule /(submit.*) http://localhost:4080/$1 [[P,L]] RewriteRule /(files.*) http://localhost:4080/$1 [[P,L]] RewriteRule /(commands.*) http://localhost:4080/$1 [[P,L]] RewriteRule /(oneframe.*) http://localhost:4080/$1 [[P,L]] RewriteRule /(noframe.*) http://localhost:4080/$1 [[P,L]] RewriteRule /(results.*) http://localhost:4080/$1 [[P,L]] RewriteRule /(i.js) http://localhost:4080/$1 [[P,L]] RewriteRule /(h.css) http://localhost:4080/$1 [[P,L]] RewriteRule /(di.js) http://localhost:4080/$1 [[P,L]] RewriteRule /(dh.css) http://localhost:4080/$1 [[P,L]] ProxyPassReverse /(.*) http://localhost:4080/$1
Source: [1] and: http://mail.nongnu.org/archive/html/mldonkey-users/2003-03/msg00377.html
We could also do just a virtual host, guaranteed to work without those confusing rewrite rules :)
# # Use name-based virtual hosting. # NameVirtualHost * # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # # This is for any site that's currently running on your machine, # make sure you move all your directives for it here, including aliases, overrides, types, etc. # otherwise, people will see the mldonkey site by default when they visit your machine's website! <VirtualHost *> ServerName domain.dynamic.ip.com ServerAlias www.domain.dynamic.ip.com ... </VirtualHost> # Now the mldonkey server, notice that the host header is the only thing you need to remember. i.e. http://mldonkey.mydomain.dyndns.org <VirtualHost *> ServerName mldonkey.domain.dynamic.ip.com <IfModule mod_proxy.c> ProxyRequests Off ProxyPass / http://localhost:4080/ ProxyPassReverse / http://localhost:4080/ </IfModule> </VirtualHost>
See also
Languages: English