我在谷歌上搜索了很多,但没有找到在自定义端口上的 virtualHost 上设置 phpmyadmin 的指南。
Apache 2.4,这是我的 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
这是日志中的错误
[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/
这些是特权
/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
我不是 Apache 专家,但您
/etc/httpd/conf/httpd.conf
是否尝试添加以下内容?Apache2 中有一个新的权限模型,默认情况如下:
所以你必须专门为你的目录添加例外。你可以在这里阅读更多相关信息