Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I googled a lot but I did not find a guide to set up phpmyadmin on a virtualHost on a custom port.

Apache 2.4, this is my httpd-vhosts.conf

Listen 0.0.0.0:66

<VirtualHost *:66>
Alias /phpmyadmin /usr/local/apache2/phpmyadmin
<Directory "/usr/local/apache2/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_value include_path .
    </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

And this is the error in the logs

 [Thu Jul 05 17:45:49.322954 2012] [authz_core:error] [pid 14314:tid 139825756501760] [client 127.0.0.1:49262] AH01630: client denied by server configuration: /usr/local/apache2/phpmyadmin/

And these are the privileges

/usr/local/apache2# ls -l
insgesamt 60
drwxr-sr-x  2 root staff  4096  6. Jun 18:40 bin
drwxr-sr-x  2 root staff  4096  6. Jun 18:40 build
drwxr-sr-x  2 root staff  4096  6. Jun 18:40 cgi-bin
drwxr-sr-x  4 root staff  4096  5. Jul 17:04 conf
drwxr-sr-x  3 root staff  4096  6. Jun 18:40 error
drwxr-xr-x  2 root staff  4096  5. Jul 17:03 htdocs
drwxr-sr-x  3 root staff  4096  6. Jun 18:40 icons
drwxr-sr-x  2 root staff  4096  6. Jun 18:40 include
drwxr-sr-x  2 root staff  4096  5. Jul 17:44 logs
drwxr-sr-x  4 root staff  4096  6. Jun 18:40 man
drwxr-xr-x 14 root staff 12288  6. Jun 17:55 manual
drwxr-sr-x  2 root staff  4096 24. Jun 18:03 modules
drwxr-sr-x  8 root staff  4096  5. Jul 17:42 phpmyadmin
share|improve this question

1 Answer 1

up vote 1 down vote accepted

I am not an Apache expert but in your /etc/httpd/conf/httpd.conf have you tried adding the following?

<Directory "/usr/local/apache2/phpmyadmin/">
Options All
AllowOverride All
Require all granted
</Directory>

There is a new permission model in Apache2 where the following is default:

<Directory />
    AllowOverride none
    Require all denied
</Directory>

So you have to specifically add exceptions for your directories. You can read more about it here

share|improve this answer
    
Ah, I didnt know that... However I tried just the "AllowOverride All", not the other one, this afternoon I will give it a try, thanks for the link, it looks interesting :) –  elect Jul 6 '12 at 6:07
    
Cool, it worked like a charm, I just needed also to open the port itself on the firewall and it went. Thanks Nic :) –  elect Jul 7 '12 at 10:06
    
@elect I am glad it worked out. –  Nic Young Jul 9 '12 at 14:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.