rmrwebmaster Posted August 9, 2007 Report Share Posted August 9, 2007 I cannot seem to get virtual hosts to work with the 3.5 version of UniServer that I just downloaded. I have read the similar posts in the forums and tried everything but to no avail. My windows host file is set up properly and below is the virtualhost part of my httpd.conf file: NameVirtualHost *<VirtualHost *>ServerName localhost:80DocumentRoot /www</VirtualHost> <VirtualHost *>ServerName localhost DocumentRoot /www/</VirtualHost> ##########VIRTUAL HOST SETUP########### DEFAULT<VirtualHost *>ServerName defaultDocumentRoot /www/default/</VirtualHost> ##########VIRTUAL HOST SETUP########### SITE1<VirtualHost *>ServerAdmin webmaster@lineandlure.comServerName site1DocumentRoot /www/site1ErrorLog logs/lnl_error_logCustomLog logs/lnl_custom_log</VirtualHost> Even though site1 points to /www/site1 all I get when I type in http://site1 is the /www/ directory instead of what is in the site1 directory. I have several sites I need to test and need to set up each one with a virtual directory. Thanks for your help Quote Link to comment Share on other sites More sharing options...
olajideolaolorun Posted August 9, 2007 Report Share Posted August 9, 2007 Did you even restart your server? Try: NameVirtualHost * <VirtualHost *> ServerName localhost:80 DocumentRoot /www </VirtualHost> ##########VIRTUAL HOST SETUP########## # DEFAULT <VirtualHost *> ServerName default DocumentRoot /www/default/ </VirtualHost> ##########VIRTUAL HOST SETUP########## # SITE1 <VirtualHost *> ServerAdmin webmaster@lineandlure.com ServerName site1 DocumentRoot /www/site1 ErrorLog logs/lnl_error_log CustomLog logs/lnl_custom_log </VirtualHost> Quote Best Regards Olajide Olaolorun The Uniform Server Development Team Link to comment Share on other sites More sharing options...
Ric Posted August 9, 2007 Report Share Posted August 9, 2007 You should not have a back slash on the pathThis:DocumentRoot /www/default/Should look like this:DocumentRoot /www/default This page explains the set-up in detail:http://center.uniformserver.com/us_35/us35...rtual_host.html As Olajide states you must restart the server after setting all vhosts for them tobe become effective. I think the killer is the log file statements comment these out, US is set-up for a centeral log file. Ric Quote Link to comment Share on other sites More sharing options...
rmrwebmaster Posted August 9, 2007 Author Report Share Posted August 9, 2007 Thanks guys looks like it was that trailing backslash. I must have overlooked that 15 times. Quote Link to comment Share on other sites More sharing options...
olajideolaolorun Posted August 9, 2007 Report Share Posted August 9, 2007 Quote Best Regards Olajide Olaolorun The Uniform Server Development Team Link to comment Share on other sites More sharing options...
Ric Posted August 9, 2007 Report Share Posted August 9, 2007 In my last post I mentioned you should comment out the log statements. I had a very good reason for this, while writing the post I suddenly remembered one of these lines will prevent the servers starting, just could not remember which one. The CustomLog Directive takes three parameters file name, format (what to log) and environment the first two are required, third is optional. Hence this line: CustomLog logs/lnl_custom_log because the second parameter is missing will prevent the servers starting. The second parameter specifies what will be written to the log file UniServer has the following defined: LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedLogFormat "%h %l %u %t \"%r\" %>s %b" commonLogFormat "%{Referer}i -> %U" refererLogFormat "%{User-agent}i" agent Each format string ends with a name (combined, common, referer and agent) these are short cuts containing the corresponding format string. You use this name as the second parameter for the custom log. The above would look like this: ErrorLog logs/lnl_error.logCustomLog logs/lnl_custom.log combined Alternatively you can us a format string directly: ErrorLog logs/lnl_error.logCustomLog logs/lnl_custom.log "%h %l %u %t \"%r\" %>s %b" You can tailor each of your custom logs to log only the information you are interested in. I am slightly confused because it seems removing the back slash was the only problem and rmrwebmaster server works without the second parameter for the custom log! Well I am posting this because my tests show that it is required on my set-up and because it is not an optional parameter. All the bestRic Quote Link to comment Share on other sites More sharing options...
rmrwebmaster Posted August 9, 2007 Author Report Share Posted August 9, 2007 Well I took out those log lines as well as removing the backslash. However, I had previously tried the system without the log lines and added them thinking a log file was needed (last ditch effort). Since the backslash was in the first virtual hosts apache probably never made it to the second and therefore the log lines did not make any difference. But it is working now and I probably don't need log files anyway. Thanks for the followup. Quote Link to comment Share on other sites More sharing options...
Ric Posted August 10, 2007 Report Share Posted August 10, 2007 Thanks for the clear and concise feedback; knowing the final outcome helps others with similar problems. I added the follow-up log information just in case someone needs to use separate log files. Seemed a good idea to keep it all in one place. Again thanks for the feedback.Ric Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.