简体   繁体   English

禁止 XAMPP 访问

[英]XAMPP Access Forbidden

I have just downloaded the latest version of XAMPP with PHP version 7.2.4.我刚刚下载了最新版本的 XAMPP,PHP 版本为 7.2.4。 I have made a very simple PHP validation for a HTML form and when I press submit it comes up with the following:我为 HTML 表单做了一个非常简单的 PHP 验证,当我按下提交时,它会出现以下内容:

Access forbidden!禁止访问! You don't have permission to access the requested object.您无权访问所请求的对象。 It is either read-protected or not readable by the server.它要么受读保护,要么无法被服务器读取。

If you think this is a server error, please contact the webmaster.如果您认为这是服务器错误,请联系网站管理员。

Error 403 localhost Apache/2.4.33 (Win32) OpenSSL/1.1.0g PHP/7.2.4错误 403 本地主机 Apache/2.4.33 (Win32) OpenSSL/1.1.0g PHP/7.2.4

I'd don't know what the problem is as I have tried changing Require none to Require all granted .我不知道问题是什么,因为我已经尝试将Require none更改为Require all granted

Please Help!请帮忙!

I have experienced this problem and found out that localhost link is not configured in httpd_vhosts.conf.我遇到过这个问题,发现httpd_vhosts.conf中没有配置localhost链接。 So I added this line at the bottom part of httpd_vhosts.conf所以我在 httpd_vhosts.conf 的底部添加了这一行

<VirtualHost *:80>
    DocumentRoot "E:/xampp/htdocs"
    ServerName localhost
</VirtualHost>

Well, probably this must be happening because the localhost link is not configured in your xamp vhost, try to look for the vhosts configuration file and add the same one there.好吧,这可能是因为 localhost 链接未在您的 xamp vhost 中配置,请尝试查找 vhosts 配置文件并在那里添加相同的配置文件。 Just add this block of code making the appropriate path changes until your repository so that you can access the localhost:只需添加此代码块,在您的存储库之前更改适当的路径,以便您可以访问本地主机:

 # Virtual Hosts # <VirtualHost *:80> ServerName localhost ServerAlias localhost DocumentRoot "${INSTALL_DIR}/www" <Directory "${INSTALL_DIR}/www/"> Options +Indexes +Includes +FollowSymLinks +MultiViews AllowOverride All Require local </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@hcode.com.br DocumentRoot "C:\\ecommerce" ServerName www.hcodecommerce.com.br ErrorLog "logs/dummy-host2.example.com-error.log" CustomLog "logs/dummy-host2.example.com-access.log" common <Directory "C:\\ecommerce"> Require all granted RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] </Directory> </VirtualHost>

By default in httpd.conf your entire system directory "/" is secured and not allowed access默认情况下,在 httpd.conf 中,您的整个系统目录“/”是安全的,不允许访问

in httpd.conf:在 httpd.conf 中:

# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />
    AllowOverride none
    Require all denied
</Directory>

Add the below additional under the above在上面的下面添加下面的附加项

<Directory /home>
   Options +Indexes +Includes +FollowSymLinks +MultiViews
   AllowOverride All
   Require local
</Directory>

Change /home to your hosted installation public directory - eg /projects or /devsite.local etc...将 /home 更改为您的托管安装公共目录 - 例如 /projects 或 /devsite.local 等...

For more info on Apache see here: https://httpd.apache.org/docs/current/mod/core.html#directory有关 Apache 的更多信息,请参见此处: https : //httpd.apache.org/docs/current/mod/core.html#directory

The 'Options' are typical .htaccess directives - change as needed “选项”是典型的 .htaccess 指令 - 根据需要更改

The 'AllowOverride All' gives access to the /home folder and everything under it “AllowOverride All”允许访问 /home 文件夹及其下的所有内容

The 'Require local' makes sure only localhost / 127.0.0.1 has access to folder and files under /home 'Require local' 确保只有 localhost / 127.0.0.1 可以访问 /home 下的文件夹和文件

Hope this helps :D希望这会有所帮助:D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM