Portal Home > Knowledgebase > Articles Database > Help with Virtual Hosting


Help with Virtual Hosting




Posted by SebringTech, 10-07-2008, 01:11 AM
At this point I have been attempting to setup Virtual Hosting for over a week. I am using Windows Server 2003 as the operating system, and planned to use Apache to handle web requests (will add PHP and SQL later). I edited my "httpd-vhosts.conf" file according to the directions I could find. I tried to paste my code in here from the file but it wouldn't let me. Said I needed 5 points. When I try to access either "domain1" or "domain2" I get the error: "Forbidden You don't have permission to access / on this server." I do own the domains I am trying to host, and have their A records and MX records pointing to my static business class IP... but I just can't get Apache to virtual host. The tutorials I have found just don't work unless I'm missing something. All web related ports are forward through firewall, there is no software firewall yet.

Posted by getweb, 10-07-2008, 01:20 AM
I'm not terribly skilled on Apache on IIS, but based on that error message, I would say your DNS and firewall are all correct... you are getting all the way through to the web server. Check your Apache error log - most likely it is simply a file permissions issue, where the Apache service's user account does not have access to the actual folders where your content is. Incorrect virtual host configuration could also contribute to this, but your error log will probably make the cause clear. If you're still not sure though, let us know what you find in the log and we can work from there. But start looking into file-level permissions, it's definitely not a DNS/Firewall issue.

Posted by SebringTech, 10-07-2008, 01:31 AM
wow what a fast and helpful response! Does Apache make its own user to access the folders or does it attempt to use the user that its running from? Either way its currently on admin until I get it running right then it'll be locked down. I'll check the folder permissions and error logs. Thank you very much for such a fast response. This is a great site edit: Error Log says "Client Denied By Server" I can see it trying to access the images and the server denies it every time.. edit again: I moved the folders that the virtual hosts are in to c:\www\site1 and c:\www\site2... I may try moving them into the htdocs folder and see if they work there. I tried changing permissions but server still refuses. Last edited by SebringTech; 10-07-2008 at 01:37 AM.

Posted by SebringTech, 10-07-2008, 01:51 AM
okay... I tried changing the user permissions of my c:\www folder to the exact same as the htdocs folder for Apache and still has the error.. I wish I could post the virtual host config file, because virtual hosting DID work for a short while then about an hour later I realized both domains were going to the same folder for their document root.

Posted by getweb, 10-07-2008, 02:04 AM
Check your "DocumentRoot" setting, and make sure there's a "" block to match it... especially if you're running as an Admin right now. Edit: And always be sure to restart Apache after making configuration changes. :-)

Posted by SebringTech, 10-07-2008, 02:09 AM
My knowledge with advanced Apache configuration is limited. Each folder for every Virtual host needs to be covered in the document root area? I tried restarting Apache and restarting the server. It is probably something unbelievably dumb I am overlooking in the configuration phase.

Posted by SparkSupport, 10-07-2008, 03:40 AM
Are you using Apache 2.20 ? Extra security bit in 2.20 causes the docroot for the vhost been inaccessible. Locate something as shown below within the root directory configuration section in the conf file. Comment out the lines shown below ( quick-and-dirty solution ) and restart apache

Posted by SebringTech, 10-07-2008, 04:59 AM
Sorry, Apache is 2.2.9 guess that would have been important information to include with the question. Okay after commenting out those two lines both websites loaded to the default htdocs folder. When I tried to call the virtual hosts at the bottom on the httpdconf file it then goes back to the "403 Forbidden You don't have permission to access / on this server." I double checked, and the file permissions should be the exact same on the vhost c:\www\domain1 and c:\www\domain1 as the default apache htdocs. My guess is that since things go haywire as soon as I throw the virtual host lines in, I'm probably not doing the virtual host lines correctly. I still need the 5 points apparently before I can post my code :-\

Posted by SebringTech, 10-07-2008, 05:04 AM
VirtualHost *:80> ServerAdmin webmaster@domain1.com DocumentRoot "C:/www/domain1" ServerName domain1.com ServerAlias www.domain1.com ErrorLog "C:/www/domain1/logs/error.log" CustomLog "C:/www/domain1/logs/access.log" common ServerAdmin webmaster@domain2.com DocumentRoot "C:/www/domain2" ServerName domain2.com ServerAlias www.domain2.com ErrorLog "C:/www/domain2/logs/error.log" CustomLog "C:/www/domain2/logs/access.log" common That's what I'm using in the vhostconfig file for Apache

Posted by SebringTech, 10-07-2008, 05:21 AM
VirtualHost *:80> ServerName www.domain1.com ServerAdmin webmaster@domain1.com DocumentRoot "C:/www/domain1" ServerName www.domain2.com ServerAdmin webmaster@domain2.com DocumentRoot "C:/www/domain2" This config works, but using the more complicated one Apache will not even start. Is there something I did incorrectly in the first vhost example?

Posted by SebringTech, 10-07-2008, 07:24 PM
Any ideas what might be wrong with the more advanced vhost configuration file? I wanted the ability to have different logs for each virtual host.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Google MXrecord (Views: 501)