Apache permission on Windows 7

Asked

Viewed 4,585 times

2

I installed Apache (version 2.2.25) on Windows 7 and changed the default folder for DocumentRoot for c:\tmp.

I made the following change to the file httpd.conf:

#DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs"
DocumentRoot "C:/tmp"

After this change I restarted the computer and tried to access the folder by browser.

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

How to solve this problem?

  • You have an index.html or index.htm in this folder?

  • The folder exists and has an index.html file

  • Apache is running as a service or standalone?

  • How do I know the difference?

  • @Lucas press the windows key, type in services.Msc and enter. Then see if the list of services has Apache and if it is running. (If you need to click it to run it, or put a shortcut in the start folder, it is probably not as a service). You can use both ways, but the permissions change a little. It’s for test environment only?

  • I did what I said and saw Apache in the list with the status of "Started" and in Boot Type is "Automatic"

  • 2

    Okay, so you’re on service anyway. Probably just hit the folder permissions, right-click on it, in the security tab, and add the apache user. Pressing Control + Shift + Esc, in the Processes tab, pressing "show all users' processes" you see the Apache credentials.

Show 2 more comments

1 answer

2


In the archive httpd.conf search for the following entry:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all          # linha padrão, geralmente causa do problema
</Directory>

Switch the line in question to:

Allow from all

This will make apache accessible to all machines on your network (and out if your router is doing port fowarding). If you want to restrict only local access use:

Deny from all 
Allow from 127.0.0.1

Another important point is the user permissions as per Bacco comments. In addition to the folder permissions it is good to check the user of Log On of service in:

services.msc -> Apache -> (Duplo Clique) -> Aba Log On

For default this must be a local system user. In this case it is recommended that the httd.conf contain the settings:

User daemon
Group daemon

P.S. Of course that’s not the best setup in terms of security. It is recommended to create a non-administrator user dedicated to the server (e. g., apache), grant this user privileges so that it can log in as a service and act as part of the operating system (in secpol.msc) and ensure access permissions consciously only for the necessary folders.


Sources:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.