6

I have the following config for one of the sites-available .conf file.
Its configure to load the ghost blog if you hit blog.example.com.
Somehow its causing example.com to serve up the blog as well. But thats fine too.

<Virtualhost *:80>
  ServerName blog.example.com
  ServerAdmin admin80@example.com
  ProxyPass        /  http://localhost:2368/
  ProxyPassReverse /  http://localhost:2368/
</Virtualhost>

So I just installed phpmyadmin and I realized I can't access it with http://example.com/phpmyadmin. Accessing that page will bring up ghost's 404 page not found instead.

So I guess I need some conditional ProxyPass to ignore /phpmyadmin ?
I tried the following by it doesn't work too.

<Virtualhost *:80>
  ServerName blog.example.com
  ServerAdmin admin80@example.com
  ProxyPass        /phpmyadmin  http://localhost/phpmyadmin
  ProxyPassReverse /phpmyadmin  http://localhost/phpmyadmin
  ProxyPass        /  http://localhost:2368/
  ProxyPassReverse /  http://localhost:2368/
</Virtualhost>

Apache just hang and I have to restart it when I hit http://example.com/phpmyadmin.

Update:

I tried the following, and it loads up phpmyadmin login page. Just added :80 after localhost. and give a specific domain name for the virtual host instead of *.

<Virtualhost blog.example.com:80>
  ServerName blog.example.com
  ServerAdmin admin@example.com
  ProxyPass        /phpmyadmin  http://localhost:80/phpmyadmin
  ProxyPassReverse /phpmyadmin  http://localhost:80/phpmyadmin
  ProxyPass        /  http://localhost:2368/
  ProxyPassReverse /  http://localhost:2368/
</Virtualhost>

Problem now is, it redirects to http://localhost/phpmyadmin/index.php?token=8fa78a71a166399749b58cd3cb66b7f2 instead. Probably some configuration with phpmyadmin I guess.

masegaloeh
  • 18,236
  • 10
  • 57
  • 106
resting
  • 1,059
  • 3
  • 10
  • 10

1 Answers1

6

You can use the ! target to prevent a location to be proxied:

<Virtualhost *:80>
  DocumentRoot     /path/to/parent/of/phpmyadmin
  ProxyPass        /phpmyadmin !
  ProxyPass        /  http://localhost:2368/
  ProxyPassReverse /  http://localhost:2368/
</Virtualhost>

This will proxy all requests to localhost:2368, except those to phpmyadmin.

Of course you'll have to set a document root, otherwise phpmyadmin won't be found.

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
  • Cool. This is the easiest solution and it solved the redirection to localhost after logging in to `phpmyadmin` too. So the redirection was caused by the proxy thing instead of some configuration. – resting Sep 01 '14 at 10:24