0

I'm running a vagrant box (Debian Wheezy) with port forward NAT networking, redirecting the browser to it through apache2 reverse proxy.

Reverse proxy vhost:

<VirtualHost *:80>
    ServerName vagrant-test.zk
    ServerAdmin webmaster@localhost

    ProxyPass / http://localhost:8080/

    ErrorLog ${APACHE_LOG_DIR}/vagrant-test.zk.error.log
    CustomLog ${APACHE_LOG_DIR}/vagrant-test.zk.access.log combined
</VirtualHost>

Everything works fine, when the browser is pointed to http://vagrant-test.zk it shows the website, without modifying the URL into the address bar. But when I point the browser to http://vagrant-test.zk/phpmyadmin, it change the URL into http://localhost:8080/phpmyadmin. PhpMyAdmin works fine, but I can't be logged into 2 vagrant boxes phpmyadmin at the same time, since there seems to be a session collision, even if different vagrant boxes listen to different TCP ports.

I think that the problem arise into /etc/phpmyadmin/apache.conf, but I don't really know where.

# phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
    Options FollowSymLinks
    DirectoryIndex index.php

    <IfModule mod_php5.c>
        AddType application/x-httpd-php .php

        php_flag magic_quotes_gpc Off
        php_flag track_vars On
        php_flag register_globals Off
        php_admin_flag allow_url_fopen Off
        php_value include_path .
        php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
        php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/
    </IfModule>

    <IfModule mod_fcgid.c>
        AddHandler fcgid-script .php
        FCGIWrapper /www/scripts/vagrant/php-fcgi .php
        Options +ExecCGI
    </IfModule>

</Directory>

# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
    <IfModule mod_authn_file.c>
    AuthType Basic
    AuthName "phpMyAdmin Setup"
    AuthUserFile /etc/phpmyadmin/htpasswd.setup
    </IfModule>
    Require valid-user
</Directory>

# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/libraries>
    Order Deny,Allow
    Deny from All
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
    Order Deny,Allow
    Deny from All
</Directory>

Any hint?

3
  • 1
    In virtual host add ProxyPassReverse / localhost:8080 May 11, 2015 at 12:59
  • Do you want from me to make it as answer to the question? May 11, 2015 at 13:11
  • If you want I will be pleased to upvote it.
    – g4b0
    May 11, 2015 at 13:22

1 Answer 1

1

G4b0,

You need to add reverse proxy directive in virtual host:

<VirtualHost *:80>
    ServerName vagrant-test.zk
    ServerAdmin webmaster@localhost

    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080
    ErrorLog ${APACHE_LOG_DIR}/vagrant-test.zk.error.log
    CustomLog ${APACHE_LOG_DIR}/vagrant-test.zk.access.log combined
</VirtualHost>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .