1

I have a server which is serving up a web page for a project.

The project is stored in a user directory on the server. (/home/user/theproject/webstuff).

Originally, I was using the userdir module to make this accessible via http://theserver/user and a symbolic link from /home/user/public_html to /home/user/theproject/webstuff to indicate the location of the files.

But, ultimately, it would be better to serve the files from http://theserver without having to indicate the user (since there really is only one user).

And then I had a truly brilliant idea.

Instead, I would rewrite my /etc/apache2/sites-enabled/000-default.conf file to read:

<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  DocumentRoot /home/user/theproject/webstuff

  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Now everything is lovely and good... except that PHP doesn't run any more.

Instead, the following error is raised:

AH01630: client denied by server configuration: /home/user/theproject/webstuff/script.php

To the client, this appears as a 403 Forbidden error.

So this is something of a dual question:

  1. Is there a better way to achieve my goal?
  2. How can I enable PHP in this situation?
Richard
  • 56,349
  • 34
  • 180
  • 251
  • Possible duplicate: http://stackoverflow.com/questions/9305680/apache-virtual-host-not-parsing-php – Marty McVry Dec 29 '13 at 18:17
  • Checked all the solutions at the proposed duplicated, @MartyMcVry, and none seem to work. Since the proposed duplicate's failure mode is to download the PHP to the user and my failure mode is a 403 forbidden, there's a reasonable chance that the questions cover separate ground and are therefore not duplicates. – Richard Dec 29 '13 at 18:49
  • 1
    Seems like an Allow/deny problem for your document root. Try adding a directory-block inside the VirtualHost. – Marty McVry Dec 29 '13 at 18:51

2 Answers2

0

You can find a well written description of this error with several possible solutions here: http://wiki.apache.org/httpd/ClientDeniedByServerConfiguration

KorreyD
  • 1,274
  • 8
  • 15
0

As it turns out, I had to edit /etc/apache2/apache2.conf.

On Line 164 there is a block which I had to modify as follows:

#<Directory /var/www>
<Directory /home/user/theproject/webstuff>
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted
</Directory>
Richard
  • 56,349
  • 34
  • 180
  • 251