Linux 为什么我无法在本地主机上访问 Xampp 的 phpmyadmin?禁止访问。
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12307842/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why can't I access Xampp's phpmyadmin on localhost? Access is forbidden.
提问by Andrew Fairbairn
I can access localhost fine on Xampp with phpmyadmin on ubuntu. I can see the contents of /htdocs which I completely cleared and wrote my own for. I want to access phpmyadmin, but cannot.
我可以在 ubuntu 上使用 phpmyadmin 在 Xampp 上正常访问本地主机。我可以看到 /htdocs 的内容,我完全清除并为其编写了自己的内容。我想访问 phpmyadmin,但不能。
When loading phomyadmin, I am greeted by a 403 Error and a note advising me to configure the setting in the file httpd-xampp.conf
. I looked in /opt/lampp/etc/extra/httpd-xampp.conf
, but have no idea what to configure.
加载 phomyadmin 时,出现 403 错误和一条建议我配置文件中的设置的注释httpd-xampp.conf
。我看了看/opt/lampp/etc/extra/httpd-xampp.conf
,但不知道要配置什么。
Two areas within the file seem useful in this scenario:
在这种情况下,文件中的两个区域似乎很有用:
<Directoy "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Order allow,deny
Deny From all
</Directory>
and
和
#
# New XAMPP security concept
#
<LocationMatch "^/(?: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 \
fe00::/10 169.254.0.0/16
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
In both segments I tried changing "Deny from all" to "Allow from all" and restarted Xampp with the command sudo /opt/lampp/lampp restart
. I received the same error page as before. I tried other solutions found online, but none have worked.
在这两个部分中,我尝试将“全部拒绝”更改为“全部允许”并使用命令重新启动 Xampp sudo /opt/lampp/lampp restart
。我收到了和以前一样的错误页面。我尝试了网上找到的其他解决方案,但都没有奏效。
What do I have to configure to access phpmyadmin?
我必须配置什么才能访问 phpmyadmin?
采纳答案by Sumit Munot
The solution can be found here. Summary follows:
可以在此处找到解决方案。总结如下:
Edit /opt/lampp/etc/extra/httpd-xampp.conf
.
编辑/opt/lampp/etc/extra/httpd-xampp.conf
。
Add the line Require all granted
to the bottom of the <Directory "/opt/lampp/phpmyadmin">
block as follows:
将行添加Require all granted
到<Directory "/opt/lampp/phpmyadmin">
块的底部,如下所示:
<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
Require all granted
</Directory>
回答by Andy
I solved this by creating a new virtual host for phpmyadmin
我通过创建一个新的虚拟主机来解决这个问题 phpmyadmin
For windows systems:
对于 Windows 系统:
Append the following to C:/xampp/apache/conf/httpd.conf
:
将以下内容附加到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>
Change the DocumentRoot/Directory
to the path where you have installed your version of phpmyadmin
.
将 更改为DocumentRoot/Directory
您安装phpmyadmin
.
Open the C:\Windows\System32\drivers\etc\hosts
file in a text editor and add the following line:
C:\Windows\System32\drivers\etc\hosts
在文本编辑器中打开文件并添加以下行:
127.0.0.1 phpmyadmin.local
then save the hosts file and restart xampp
.
然后保存主机文件并重新启动xampp
。
回答by Muhammad Shahzad
Try this
尝试这个
New XAMPP security concept
新的 XAMPP 安全概念
Search in httpd-xampp.conf
在 httpd-xampp.conf 中搜索
<LocationMatch "^/(?i:(?:xampp|security|phpmyadmin|licenses|webalizer|server-status|server-info))">
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
Replace with or remove phpmyadmin
替换或删除 phpmyadmin
<LocationMatch "^/(?i:(?:xampp|security|licenses|webalizer|server-status|server-info))">
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>