dov6891 2013-12-29 18:13
浏览 15

重新指向全局DocumentRoot,仍然运行PHP

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?
  • 写回答

2条回答 默认 最新

  • dql123000 2013-12-29 19:00
    关注

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

    评论

报告相同问题?