1

I'm running Apache 2.4.6 on Ubuntu 13.

In sites-available, I have a conf file for my site that contains only this:

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin somebody@somewhere.com
  ServerName  www.ourco.me
  ServerAlias ourco.me

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/ouruser/public/ourco.me/public

  # Log file locations
  LogLevel warn
  ErrorLog  /home/ouruser/public/ourco.me/log/error.log
  CustomLog /home/ouruser/public/ourco.me/log/access.log combined
</VirtualHost>

There are no other conf files enabled. When I have use apachectl -S to display the sites, it shows:

VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server www.ourco.me (/etc/apache2/sites-enabled/ourco.me.conf:1)
         port 80 namevhost www.ourco.me (/etc/apache2/sites-enabled/ourco.me.conf:1)
                 alias ourco.me
         port 80 namevhost www.ourco.me (/etc/apache2/sites-enabled/ourco.me.conf:1)
                 alias ourco.me
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
Mutex mpm-accept: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

The first thing I notice is the duplicate entry for namevhost www.ourco.me. And when I visit the site in a browser, I get:

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

Apache/2.4.6 (Ubuntu) Server at www.ourco.me Port 80

All the directories and files specified in the conf file exist. a2ensite and a2dissite work as expected to add/remove a symlink for this file from sites-enabled, so it's looking at the right file. Does anyone know why its directives are being ignored? Thanks.

Oscar
  • 2,039
  • 2
  • 29
  • 39

2 Answers2

1
Put Allow from all

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin somebody@somewhere.com
  ServerName  www.ourco.me
  ServerAlias ourco.me

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/ouruser/public/ourco.me/public

  # Log file locations
  LogLevel warn
  ErrorLog  /home/ouruser/public/ourco.me/log/error.log
  CustomLog /home/ouruser/public/ourco.me/log/access.log combined
 Allow from all
</VirtualHost>
prasoon
  • 901
  • 8
  • 25
  • Thanks, but that doesn't work. The result is: AH00526: Syntax error on line 16 of /etc/apache2/sites-enabled/ourco.me.conf: allow not allowed here Action 'configtest' failed. – Oscar Mar 11 '14 at 19:01
  • "Require all granted", which appears to be the new syntax, also fails with a similar message. – Oscar Mar 11 '14 at 19:07
1

This appears to solve the problem:

<Directory />
  Require all granted
</Directory>

when placed in the VirtualHost entry.

That snippet came from this post. I'm looking at this Apache doc to see why it works.

Community
  • 1
  • 1
Oscar
  • 2,039
  • 2
  • 29
  • 39