0

I'm trying to configure a new virtual host with apache 2.4.16 Premise: I already have other virtual hosts and they work fine, so what I've done is simply duplicate the vhost and change paths and names.

The scenario is this one. I created a new vhost that contains this:

<VirtualHost *:80>
DocumentRoot "/Users/me/Sites/mynewsite/web"
ServerName mynewsite.lo

<Directory "/Users/me/Sites/mynewsite/web">
        Require all granted
        Options FollowSymLinks
</Directory>

ErrorLog /var/log/apache2/mynewsite.localhost-error.log
CustomLog /var/log/apache2/mynewsite.localhost-access.log combine

At this point I tried to load the page mynewsite.lo/robots.txt ant I get this error

Forbidden

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

Now, I tried to solve the issue looking at the access_log, error_log but nothing was written there. So by ls -latr command I discovered that another logfile was changed, the myoldsite.localhost-error.log

Looking in that file I found

[Wed Oct 21 16:16:32.979200 2015] [authz_core:error] [pid 283] [client 127.0.0.1:56427] AH01630: client denied by server configuration: /Users/me/Sites/myoldsite
[Wed Oct 21 16:16:33.206456 2015] [authz_core:error] [pid 283] [client 127.0.0.1:56427] AH01630: client denied by server configuration: /Users/me/Sites/myoldsite, referer: http://mynewsite.lo/robots.txt
[Wed Oct 21 16:16:33.277496 2015] [authz_core:error] [pid 283] [client 127.0.0.1:56427] AH01630: client denied by server configuration: /Users/me/Sites/myoldsite, referer: http://mynewsite.lo/robots.txt

Now I don't know what's happening. The logs are written to the wrong file and when I try to reach mynewsite.lo I get the forbidden error message.

What am I doing wrong?

  • Are you on Mac OS (as the */Users* directory suggests)? Have you tried to store you document root outside your home directory? Are you using home directory encryption? Have you fully restarted your Apache after changing configuration, or only reloaded it (so called *graceful restart*)? – sam_pan_mariusz Oct 21 '15 at 18:32
  • Yes, I'm on Mac OS, I tried to use another folder. I don't have encryption on directories and I restarted apache with `sudo apachectl restart`. In addition, I have other hosts that work fine, only this one has the problem described.. – Andrea Giuliano Oct 22 '15 at 10:15
  • I solved with a restart of the entire system.. I don't know what the problem was, but now it works – Andrea Giuliano Oct 23 '15 at 08:27

1 Answers1

0

At the moment I can only recommend enabling LogLevel debug, so the error log (no matter which one) can tell you a little more details to aid troubleshooting.

You can also try sudo -u APACHE_USER -- ${SHELL} (preferably from a root user account) and then cd to /Users/me/Sites/mynewsite/web, to exclude a filesystem permissions problem. Substitute the real user httpd runs as for APACHE_USER - I know little of Mac OS so I can't tell you the exact name.

sam_pan_mariusz
  • 2,133
  • 1
  • 14
  • 15