Apache 2 mod_rewrite

tgray96

[H]ard|Gawd
Joined
Dec 13, 2010
Messages
1,055
I am running McMyAdmin on my minecraft server, to connect to the mcmyadmin panel:
its domain:8080
I'd like to change that to domain/admin

following a post on the mcmyadmin/phonicuk forums I added this to my httpd.conf

VirtualHost *>
ServerName mine.twpclan.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass /mcma http://localhost:8080/
ProxyPassReverse /mcma http://localhost:8080/
RewriteRule ^/mcma$ http://mine.twpclan.com/mcma [R,L]
</VirtualHost>

And get this when trying to visit that address:

Service Temporarily Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Apache/2.2.15 (CentOS) Server at mine.twpclan.com Port 80
 
Is mod_rewrite enabled? Usually this error is caused by mod_rewrite not being on or sometimes by a conflicting endless loop (triggering two mod_rewrite rules at the same time). Also, Apache is utterly terrible as a reverse HTTP proxy. If performance is a concern for you, consider using an HTTP server that was designed with that goal in mind, like Cherokee or Nginx.
 
According to the httpd.conf or the .htaccess? I don't have one. Not really worried about performance, only a handful of people will be using this.
 
If you're on Debian/Ubuntu try a "sudo a2enmod mod_rewrite." On other Linux/Mac/Windows, make sure there's a line in your httpd.conf that looks like this:
LoadModule rewrite_module modules/mod_rewrite.so
 
I have a feeling your issue is with these lines:


ProxyPass /mcma http://localhost:8080/
ProxyPassReverse /mcma http://localhost:8080/

If I recall correctly, you need to specify the domain instead of using localhost. I normally use Nginx for reverse proxies so my Apache proxy skills may be a bit rusty and I could be totally wrong but it's easy to try and see if it works or not.
 
domain=no worky. I have tried nginx before, and it didn't work well. If someone has a guide, for installing this plus+reverse proxy, I would be willing to try it.
 
Uhh... I must be missing something.

Proxy directives are in mod_proxy, not mod_rewrite. Is mod_proxy enabled? I see no mention of it in this thread.

Edit: Also since it's an admin type section you may want the ProxyPassReverseCookiePath directive as well.
 
Last edited:
Back
Top