2015-01-15 133 views
14

我还没有在其他问题中找到适合我的正确答案。 这是httpd-xampp.conf怎么看起来像原来:httpd-xampp.conf:如何允许访问除localhost之外的外部IP?

# 
# New XAMPP security concept 
# 
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))"> 
     Require local 
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var 
</LocationMatch> 

,我应该怎么做,如果我想添加另一个IP地址除了Require local

例如,下面Require local我曾尝试以下:

allow from xxx.xxx.xxx.xx 

也就是说:

# 
# New XAMPP security concept 
# 
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))"> 
     Require local 
     allow from xxx.xxx.xxx.xx 
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var 
</LocationMatch> 

但它仍然阻止访问外部IP。

我该如何解决这个问题? 如何添加更多IP地址以允许他们访问?

我在Windows环境下使用XAMPP 5.6.3。

回答

20

allow from all将不会与Require local一起工作。相反,尝试Require ip xxx.xxx.xxx.xx

例如:

# New XAMPP security concept 
# 
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))"> 
    Require local 
    Require ip 10.0.0.1 
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var 
</LocationMatch> 
+0

谢谢!它现在像一种魅力。 – Pathros 2015-02-03 21:46:41

+3

你好!我已经在Windows Server 2012上安装了xampp。我有一个公共IP,并输入像这样“Require ip my-ip” 仍然无法从IP 访问我的本地主机感谢 – 2015-02-05 10:56:56

10

我想这和它的作品。但要小心。这意味着你局域网中的任何人都可以访问它。 Deepak Naik的回答更安全。

# 
# New XAMPP security concept 
# 
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))"> 
    # Require local 
    Require all granted 
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var 
</LocationMatch> 
-3

开放在你的防火墙

新的应用程序中包含 “httpd”(Apache服务器)看看这个:https://www.youtube.com/watch?v=eqgUGF3NnuM

+2

您能分享youtube链接中描述的主要步骤在这里,如果视频不再可用,那么您的答案仍然有帮助? – TehSphinX 2016-07-18 08:12:58

0

添加以下代码到文件d:\ XAMPP \ apache的\的conf \额外\的httpd-xampp.conf:

<IfModule alias_module> 
... 
    Alias/"d:/xampp/my/folder/" 
    <Directory "d:/xampp/my/folder"> 
     AllowOverride AuthConfig Limit 
     Order allow,deny 
     Allow from all 
     Require all granted 
    </Directory> 

以上配置可以从http://127.0.0.1/

访问

注:有人建议更换从Require localRequire all granted,但不适合我

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))"> 
    # Require local 
    Require all granted 
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var 
</LocationMatch> 
-1
<Directory "E:/xampp/phpMyAdmin/"> 
AllowOverride AuthConfig Limit 
Order allow,deny 
Allow from all 
Require all granted 

-1

Windows中的所有你所要做的就是去Windows搜索允许程序通过Windows防火墙应用程序工作。点击允许其他应用程序选择Apache,并标记公有和私有两者。按windows键打开cmd + r写入cmd比cmd写入ipconfig找出你的ip。比打开你的浏览器写下你的ip http://172.16..x,你将会在xampp启动页面上。如果你想访问你的本地站点,只需将你的ip放在/ infront,例如http://192.168.1.x/yousite。现在您可以在私人网络计算机上访问您的网站。

我希望这将解决您的问题

4
<Directory "C:/xampp/"> 
    AllowOverride AuthConfig Limit 
    Order allow,deny 
    Allow from all 
    Require all granted 
</Directory> 

这是我在文件\ XAMPP \ apache的\的conf \额外\的httpd-xampp.conf文件的末尾添加标记之前