agirman
03-20-2007, 02:35 PM
Hi everyone,
I'm having the darnedest time getting my apache server up and running to spec. I am running apache server 2.2.2, and I recently tried to set up some virtual hosting. The applicable portion of httpd.conf is as follows:
Listen 80
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot /usr/local/apache2/htdocs
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /usr/local/apache2/htdocs
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName subdomain.mydomain.com
DocumentRoot /Users/agirman/Documents/workspace
</VirtualHost>
I'm using 127.0.0.1 because it's a development machine, and I'm not too concerned about browsing to it from an external source. I've added all the applicable entries to /etc/hosts and installed BIND to perform DNS lookups on the local machine (so it doesn't go to the internet version of mydomain.com).
Punching in "http://mydomain.com" into firefox gives me a resounding "It works!", indicating to me that it is successfully serving the default index.html out of my apache2/htdocs folder. However, entering "http://subdomain.mydomain.com" gives me a 403 forbidden error, that looks something like:
Forbidden
You don't have permission to access / on this server.
The corresponding entry from apache2/logs/error_log is:
[Tue Mar 20 15:16:26 2007] [error] [client 127.0.0.1] (13)Permission denied: access to / denied
which worries me a little, because it almost looks like it's trying to open root. So, I tried making a symbolic link in apache2/htdocs such that apache2/htdocs/subdomain would point to the document root specified by subdomain.mydomain.com. There is an entry in error_log as follows:
[Tue Mar 20 14:19:45 2007] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /usr/local/apache2/htdocs/subdomain
I tried chmod'ing the directory to 777 (it does not seem to be a simple permissions problem). I have the following directory directives in httpd.conf:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "/usr/local/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/Users/agirman/Documents/workspace">
Options Indexes FollowSymLinks #I don't know why it says it won't
AllowOverride None
Order allow,deny
Allow from 127.0.0.1 #this was previously all, so this isn't the problem.
</Directory>
I am starting to think that either (a) apache isn't correctly channeling requests to the appropriate directory, or (b) this is something to do with apple's permission systems (I've had a hard time getting things to play nicely between the unix portions and the mac portions of the OS in the past). Those are just guesses, however. If anyone has any idea as to what the problem could be, it would be much appreciated.
Regards,
Alex.
I'm having the darnedest time getting my apache server up and running to spec. I am running apache server 2.2.2, and I recently tried to set up some virtual hosting. The applicable portion of httpd.conf is as follows:
Listen 80
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot /usr/local/apache2/htdocs
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /usr/local/apache2/htdocs
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName subdomain.mydomain.com
DocumentRoot /Users/agirman/Documents/workspace
</VirtualHost>
I'm using 127.0.0.1 because it's a development machine, and I'm not too concerned about browsing to it from an external source. I've added all the applicable entries to /etc/hosts and installed BIND to perform DNS lookups on the local machine (so it doesn't go to the internet version of mydomain.com).
Punching in "http://mydomain.com" into firefox gives me a resounding "It works!", indicating to me that it is successfully serving the default index.html out of my apache2/htdocs folder. However, entering "http://subdomain.mydomain.com" gives me a 403 forbidden error, that looks something like:
Forbidden
You don't have permission to access / on this server.
The corresponding entry from apache2/logs/error_log is:
[Tue Mar 20 15:16:26 2007] [error] [client 127.0.0.1] (13)Permission denied: access to / denied
which worries me a little, because it almost looks like it's trying to open root. So, I tried making a symbolic link in apache2/htdocs such that apache2/htdocs/subdomain would point to the document root specified by subdomain.mydomain.com. There is an entry in error_log as follows:
[Tue Mar 20 14:19:45 2007] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /usr/local/apache2/htdocs/subdomain
I tried chmod'ing the directory to 777 (it does not seem to be a simple permissions problem). I have the following directory directives in httpd.conf:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory "/usr/local/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/Users/agirman/Documents/workspace">
Options Indexes FollowSymLinks #I don't know why it says it won't
AllowOverride None
Order allow,deny
Allow from 127.0.0.1 #this was previously all, so this isn't the problem.
</Directory>
I am starting to think that either (a) apache isn't correctly channeling requests to the appropriate directory, or (b) this is something to do with apple's permission systems (I've had a hard time getting things to play nicely between the unix portions and the mac portions of the OS in the past). Those are just guesses, however. If anyone has any idea as to what the problem could be, it would be much appreciated.
Regards,
Alex.