I tried all suggestions about permissions I could find but without luck. Apache seems to start normally

[ ok ] Restarting web server: apache2 ... waiting ..

Access log says - - [12/Feb/2016:04:19:48 -0800] "GET / HTTP/1.1" 403 498 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36"

Error log:

[Fri Feb 12 04:19:48 2016] [error] [client] (13)Permission denied: access to / denied

ls -al /var/www:

root@AOScloud:/etc/apache2# ls -la /var/www
total 12
drwxr-xr-x  2 root     root     4096 Feb 12 03:33 .
drwxr-xr-x 13 root     root     4096 Feb 12 03:31 ..
-rwxr-xr-x  1 www-data www-data  177 Feb 12 03:33 index.html

ls -ld /var/www

root@AOScloud:/etc/apache2# ls -ld /var/www
drwxr-xr-x 2 root root 4096 Feb 12 03:33 /var/www

In apache2.conf I added

DocumentRoot /var/www

<Directory /var/www/>
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted

I am running a Debian 4.2.0 Kernel

This is the content of /etc/apache2/sites-available/default as requested below:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

closed as off-topic by Jeff Schaller, jimmij, slm Jun 26 '16 at 14:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jeff Schaller, jimmij, slm
If this question can be reworded to fit the rules in the help center, please edit the question.

  • if you're using apache 2.2, first thing, the directive Require all granted should be replace by: Order allow,deny\nAllow from all – dervishe Feb 12 '16 at 12:37
  • Changed but no change in result... – Reto Feb 12 '16 at 12:42
  • Please add the output of ls -la /var/www – Rui F Ribeiro Feb 12 '16 at 12:45
  • 1
    Did you restart Apache after changing the config file? – schaiba Feb 12 '16 at 12:45
  • 1
    you are missing DocumentRoot /var/www and then restart (outside of the Directory directive) – Rui F Ribeiro Feb 12 '16 at 13:21

It is working now. For some reason www-data user was corrupt... I added a new user www and changed everything to this user www. Now it works...


Apache from a Debian based package defaults for review below:

https://catjcode.com/apache_conf.txt "Default apache conf"

https://catjcode.com/apache_site.txt "Default apache site"

Try a more minimal, default configuration for getting the or similar accessible. Then and add back in each needed portion of your configuration.

Another possible issue in the log message posted:

access to / denied

Server could be configured in a way such that attempting to view, was seen as an index: Apache directory indexes or file listing, which are often turned off by default. The default handler as index.html could be lacking configuration. Suggest attempt directly going to to see if error in log is different.

Also check symbolic links if any. Suppose your site is actually not using /etc/apache2/sites-available/default as its configuration, there being a different file in use, negating any of your changes. below from typical setup; note symbolic link and naming scheme:

ls /etc/apache2/sites-enabled/ -lah
drwxr-xr-x 2 root root 4.0K Aug 29 11:43 .
drwxr-xr-x 8 root root 4.0K Aug 29 11:40 ..
lrwxrwxrwx 1 root root   35 Aug 29 11:38 000-default.conf -> ../sites-available/000-default.conf

To help diagnose permission issues: check if www-data is used by Apache, start Apache and then review the process owner. Note www-data below:

ps -ef|fgrep apache

root      1495     1  0 Feb16 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  5239  1495  0 09:33 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  5240  1495  0 09:33 ?        00:00:00 /usr/sbin/apache2 -k start

Review file system permissions; example below:

ls -lah /var/www/html/
drwxr-xr-x 6 root     root 4.0K Sep  9 13:30 .
drwxr-xr-x 3 root     root 4.0K Aug 29 11:38 ..
drwxr-xr-x 2 www-data root 4.0K Aug 30 17:56 cgi-bin
drwxr-xr-x 2 www-data root 4.0K Sep  9 13:26 css
drwxr-xr-x 2 www-data root 4.0K Sep  8 12:36 images
drwxr-xr-x 2 www-data root 4.0K Sep  9 10:14 js
-rw-r--r-- 1 www-data root 3.4K Sep  9 13:14 index.html
  • You mean I should replace my apache2.conf with the content of apache_conf.txt? And where should apache_site.txt go? – Reto Feb 12 '16 at 15:50
  • Replace or review and locate anything varying from defaults. The site would be in your case /etc/apache2/sites-available/default. Be sure any sym link is OK when changing, moving around the site file. – kph0x1 Feb 12 '16 at 15:58
  • I am still on default. Nothing changed since I installed apache. index.html still contains the default apache code. – Reto Feb 16 '16 at 8:05
  • I used your apache conf and apache site. With apache site there was an error when starting the server /var/www/html does not exist. So I created it and added index.html. Still the same error, even with IP/index.html: You don't have permission to access /index.html on this server. With your apache conf I get an error Invalid command 'Mutex' – Reto Feb 17 '16 at 7:52
  • How can I check if apache really uses www-data user? It looks like www-data is set as user in the config file, but how can I double check? – Reto Feb 17 '16 at 8:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.