LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Config file for Apache name-based virtual hosting (https://www.linuxquestions.org/questions/linux-software-2/config-file-for-apache-name-based-virtual-hosting-426957/)

mnm_mc 03-21-2006 11:09 AM

Config file for Apache name-based virtual hosting
 
I am trying to configure the config file to host more than one website using name-based virtual hosting.

i am using Apache/2.0.54 (Linux/SUSE) and followed the directions at:


http://httpd.apache.org/docs/2.0/vhosts/name-based.html


NameVirtualHost *:80

<VirtualHost *:80>

ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain

</VirtualHost>

<VirtualHost *:80>

ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain

</VirtualHost>

This is all that I have done on the config file, of course I changed the domain names :)

I am wondering if there is more than just doing that?

thanks Mike

zeitounator 03-21-2006 11:16 AM

What is wrong with this configuration or what does not work as expected ?

mnm_mc 03-21-2006 11:40 AM

ya it doesn`t work, it just works only if I have two IPs (which it is setup on now, so I am running two webservers and would like to run just one and contain the websites on one system

I am wondering if I need to modify the file anymore than I have already.

zeitounator 03-21-2006 11:51 AM

What is the configuration of your default server in httpd.conf ? Can you access it from http://localhost or http://127.0.0.1 or http://yourIP ?

Did you bind apache to the correct ip (the one that corresponds to the dns entry for the domains - look at the 'listen' directive) ?

mnm_mc 03-21-2006 12:34 PM

Quote:

Originally Posted by zeitounator
What is the configuration of your default server in httpd.conf ? Can you access it from http://localhost or http://127.0.0.1 or http://yourIP ?

Did you bind apache to the correct ip (the one that corresponds to the dns entry for the domains - look at the 'listen' directive) ?

crap the config file has no entries, I am using both windows and linux, i think the problem is windows...go figure eh?

when i set up apache on linux it was simple and all i did was copy an index page and related files into the /srv/www/htdocs and it worked. I didnt have to even touch the config file.

using apache on windows was a little more of a setup and different directory structure.

I am going to try and modify the config file and it will more than likely work.

I will post a repsonse and let you know if it works, thanks for your help mike

mnm_mc 03-22-2006 03:29 AM

geez i just cant seem to get the dam thing to work...can someone help with this?


I made the changes as per named host and still nothing....

I am just wondering as when I setup apache some info was input into the config file such as email and domain name.

so by default the first domain shows up, so do i need to comment those entries out then try the domains with the config file?

Or do I just add the secondary domain to the virtual host and call it good?
thanks for any help or insight! mike

here is the section I got off the net and input it into the config file, the lines are unchanged so far and are commented out.

# Use name-based virtual hosting.
#
#NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>


All times are GMT -5. The time now is 11:25 AM.