Jump to content
The Uniform Server Community

Virtual Hosts not working for me UniServer 3.5


rmrwebmaster
 Share

Recommended Posts

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:80

DocumentRoot /www

</VirtualHost>

 

<VirtualHost *>

ServerName localhost

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>

 

 

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

You should not have a back slash on the path

This:

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 :D

Link to comment
Share on other sites

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\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{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.log

CustomLog logs/lnl_custom.log combined

 

Alternatively you can us a format string directly:

 

ErrorLog logs/lnl_error.log

CustomLog 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! :D

 

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 best

Ric

:D

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...