Apache access forbidden windows

Information Security Squad

stay tune stay secure

  • Home
  • 2020
  • Июль
  • 19
  • 🛠️ Исправляем ошибку “Forbidden – You don’t have permission to access / on this server”

🛠️ Исправляем ошибку “Forbidden – You don’t have permission to access / on this server”

Веб-сервер управляет огромным рынком, особенно на платформах веб-хостинга.

Как бы то ни было, вы можете получить ошибку «Forbidden – You don’t have permission to access / on this server» в вашем браузере после настройки вашего веб-сайта.

  • HTTP Error 403 – Forbidden
  • Forbidden: You don’t have permission to access [directory] on this server
  • 403 Forbidden
  • Access Denied You don’t have permission to access
  • 403 forbidden request forbidden by administrative rules

Так что вызывает такие ошибки?

‘403 ошибка‘ возникает по следующим основным причинам:

1. Неправильные права доступа к файлам / каталогам

2. Неправильная настройка файлов конфигурации Apache

Эта ошибка также может быть связана с неправильной настройкой одного из файлов конфигурации Apache.

Это может быть неверный параметр, который был включен по ошибке, или отсутствующие директивы в файле конфигурации.

Фиксим ‘403 Forbidden Error’

Если вы столкнулись с этой ошибкой, вот несколько шагов, которые вы можете предпринять, чтобы исправить это.

1. Настройте права доступа к файлам и владение каталогом webroot

Известно, что неправильные права доступа к файлам и владение каталогами ограничивают доступ к файлам сайта .

Поэтому, во-первых, убедитесь, что права доступа к файлам рекурсивно назначены каталогу webroot, как показано далее.

Каталог webroot всегда должен иметь разрешения EXECUTE, а файл index.html должен иметь разрешения READ.

Кроме того, настройте владельца каталога, как показано далее:

Читайте также:  Hp smart array s100i sr gen10 драйвер windows 2016

Где user является обычным вошедшим в систему пользователем, а группа – www-data или apache.

Наконец, перезапустите веб-сервер Apache, чтобы изменения вступили в силу.

2. Настройте директивы в главном конфигурационном файле Apache

Сохраните и выйдите, а затем перезапустите Apache.

Apache giving 403 forbidden errors

Ok, so i’ve previously set up two virtual hosts and they are working cool. they both house simple web projects and work fine with http://project1 and http://project2 in the browser.

Anyway, I’ve come to add another vhost. I edited the /etc/hosts file with 127.0.0.1 project3 and also updated the httpd-vhosts.conf file by copy and pasting the previous entries for project2 and editing the file path.

I’ve checked all the file and folder permissions (in fact I copied and pasted from project2) and simply put a «hello world» message in the index.php file.

I get a 403 forbidden permission denied message when accessing http://project3

Why is this, I just can figure out what step I’ve missed as everything seems to be set up correct.

8 Answers 8

  • Apache can physically access the file (the user that run apache, probably www-data or apache, can access the file in the filesystem)
  • Apache can list the content of the folder (read permission)
  • Apache has a «Allow» directive for that folder. There should be one for /var/www/, you can check default vhost for example.

Additionally, you can look at the error.log file (usually located at /var/log/apache2/error.log ) which will describe why you get the 403 error exactly.

Finally, you may want to restart apache, just to be sure all that configuration is applied. This can be generally done with /etc/init.d/apache2 restart . On some system, the script will be called httpd. Just figure out.

I just fixed this issue after struggling for a few days. Here’s what worked for me:

First, check your Apache error_log file and look at the most recent error message.

If it says something like:

then there is a problem with your file permissions. You can fix them by running these commands from the terminal:

Читайте также:  Контекстное меню windows explorer

Then, refresh the URL where your website should be (such as http://localhost/mySite ). If you’re still getting a 403 error, and if your Apache error_log still says the same thing, then progressively move up your directory tree, adjusting the directory permissions as you go. You can do this from the terminal by:

If necessary, continue with:

and, if necessary,

DO NOT go up farther than that. You could royally mess up your system. If you still get the error that says search permissions are missing on a component of the path , I don’t know what you should do. However, I encountered a different error (the one below) which I fixed as follows:

If your error_log says something like:

then your problem is not with your file permissions, but instead with your Apache configuration.

Notice that in your httpd.conf file, you will see a default configuration like this (Apache 2.4+):

or like this (Apache 2.2):

DO NOT change this! We will not override these permissions globally, but instead in your httpd-vhosts.conf file. First, however, make sure that your vhost Include line in httpd.conf is uncommented. It should look like this. (Your exact path may be different.)

Now, open the httpd-vhosts.conf file that you just Include d. Add an entry for your webpage if you don’t already have one. It should look something like this. The DocumentRoot and Directory paths should be identical, and should point to wherever your index.html or index.php file is located. For me, that’s within the public subdirectory.

The lines saying

are critical for Apache 2.4+. Without these, you will not be overriding the default Apache settings specified in httpd.conf . Note that if you are using Apache 2.2, these lines should instead say

This change has been a major source of confusion for googlers of this problem, such as I, because copy-pasting these Apache 2.2 lines will not work in Apache 2.4+, and the Apache 2.2 lines are still commonly found on older help threads.

Читайте также:  Windows 10 максимальная ключик для активации

Once you have saved your changes, restart Apache. The command for this will depend on your OS and installation, so google that separately if you need help with it.

I hope this helps someone else!

PS: If you are having trouble finding these .conf files, try running the find command, such as:

WAMP 403 Forbidden message on Windows 7

I have installed WAMP version 2.1 on my windows 7 machine. When i browse to localhost in my browser, the WAMP server page is visible.

But when I browse to my IP in my browser, I get the message

403 Forbidden: You don’t have permission to access / on this server.

26 Answers 26

The access to your Apache server is forbidden from addresses other than 127.0.0.1 in httpd.conf (Apache’s config file) :

The same goes for your PHPMyAdmin access, the config file is phpmyadmin.conf :

You can set them to allow connections from all IP addresses like follows :

I found a simpler fix.

Although the icon was green WAMP still needs to be «Put Online» (last item of menu when left-clicking icon).

After that I had access as normal.

For me the inclusion of «Require local» helped to solve Error 403. The alias config file looks like this:

The solution for changing the permissions in the httpd.conf will work if you are OK with providing access to the WAMP server from outside.

If you do not want to do that then all you have to do is tell windows that the «localhost» domain points to 127.0.0.1. You can do that by editing the hosts file in your system directory.

The file is placed at : C:\Windows\System32\drivers\etc\hosts

by default windows 7 ships with :

You have to un-comment the mapping for localhost:

Note: you will not be able to edit the hosts file as its a read-only file. To edit, you have to be the administrator, copy the file to some other location, edit it and then copy it back to the etc directory.

Оцените статью