2012-10-19 136 views
4

我试图设置Xampp进行家庭开发。它的安装正确,我可以访问像演示,安全,状态等xampp页面,甚至使用phytin-gui来启动和停止服务器。Xampp:我无法从本地主机访问phpMyAdmin

但是,当涉及使用访问phpMyAdmin的“http://localhost/phpmyadmin”我得到了一个错误:

Access forbidden! 

New XAMPP security concept: 

Access to the requested directory is only available from the local network. 

This setting can be configured in the file "httpd-xampp.conf". 

我检查了我的httpd-xampp.conf,似乎是正确的。我试图改变拒绝所有的允许所有,但没有工作。

我的主机文件指向localhost到127.0.0.1,这是预计访问所有xampp文件。

我乳宁XAMPP 1.8.1在Ubuntu 12.04机器

有人说有同样的问题?我失去了2个小时的谷歌搜索,但所有我发现的是,当试图从其他网络或机器访问服务器时发生此错误。但对我来说,情况是我直接在服务器上工作,所以它假设我可以访问phpMyAdmin作为默认值。

我的httpd-xampp.conf

# 
# New XAMPP security concept 
# 
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))"> 
    Order deny,allow 
    Deny from all 
    Allow from ::1 127.0.0.0/8 \ 
     fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \ 
     fe80::/10 169.254.0.0/16 

    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var 
</LocationMatch> 
+0

看: http://stackoverflow.com/a/16617319/2395363 – Andy

回答

5

转到/opt/lampp/etc/extra目录中的情况下,你已经/opt下安装了XAMPP,并编辑httpd-xampp.conf添加Require all granted,如下图所示:

# since XAMPP 1.4.3 
<Directory "/opt/lampp/phpmyadmin"> 
    AllowOverride AuthConfig Limit 
    Order allow,deny 
    Allow from all 
    Require all granted 
</Directory> 

你可能有通过运行/opt/lampp/lampp restart来重新启动LAMPP服务器。

+1

这不只是禁用一个黑客**所有** phpmyadmin路径的安全性?错误的真正原因是什么? ref:[Require Directive](http://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#require)'要求所有授予的 无条件地允许访问。' – 2013-05-13 09:10:40

+0

您正确地指出解决方案以上授予无条件访问权限。 **原因**:127.0.0.1只能访问安全文件夹并拒绝来自LAN的访问。 **若要解决**问题并在某种程度上维护安全性,您可以在代码
下尝试'Allow from xxx.xxx.x.xxx xxx.xxx.x.xxx',如果您想要将多个IP地址添加到从规则中允许,只需在最后一行之后添加一个空格,或者使用反斜杠“\”结束一行,并且可以直接在下一行写入。 –

2

我也在XAMPP自己的论坛中发现了这个问题。提到Require all granted答案,但是无条件授予访问权限。螺纹继续提供a better solution

Just update your httpd-xampp.conf. Replace the End with:

# 
# New XAMPP security concept 
# 
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))"> 
    <RequireAny> 
     Require ip ::1 127.0.0.0/8 \ 
     fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \ 
     fe80::/10 169.254.0.0/16 
    </RequireAny> 
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var 
</LocationMatch> 

Then restart your lampp with: sudo /opt/lampp/lampp restart

裁判:http://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#require

0

我通过创建phpmyadmin

一个新的虚拟主机解决了这个附加以下到C:/xampp/apache/conf/httpd.conf

NameVirtualHost phpmyadmin.local 

<VirtualHost phpmyadmin.local> 
    ServerName phpmyadmin.local 
    DocumentRoot "C:/xampp/htdocs/phpmyadmin" 
    <Directory "C:/xampp/htdocs/phpmyadmin"> 
    AllowOverride All 
    Allow from All 
    </Directory> 
</VirtualHost> 

DocumentRoot/Directory更改为您安装了版本的路径10。

打开C:\Windows\System32\drivers\etc\hosts文件在文本编辑器,并添加以下行:

127.0.0.1  phpmyadmin.local 

然后保存hosts文件并重新启动xampp

https://stackoverflow.com/a/16617319/2395363

0

这适用于1.8.2 XAMPP答案[PHP:25年5月4日]

只要把#号之前需要本地之下,而且重要的是,停在XAMPP控制面板启动Apache。这就是它,它肯定在我的答案本主题工作

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))"> 
     #Require local 

    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var 
</LocationMatch>