LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   apache (https://www.linuxquestions.org/questions/linux-software-2/apache-71018/)

Spaz17 07-08-2003 12:58 PM

apache
 
i cannont get multiple web address to run on one ip address
ive done exactly what apaches online manual says
o yea ive got apache 2.0.46
anyway, i listen to port 80
my main host is the same as my first virtual host
i have all hosts listening to all ips
i do not know what is wrong
help?

trickykid 07-08-2003 01:14 PM

Well, any error messages when restarting your apache server? Can you post your httpd.conf file with the portion of the virtual hosts defined in it here?

david_ross 07-08-2003 01:16 PM

Are the other DNS entries pointing to the host?
Have you restarted apache?

Can you post the virtualhost section of httpd.conf

Spaz17 07-08-2003 02:12 PM

ya i can restart with no problem
i changed the domain names to protect the innocent
--------------------------------
NameVirtualHost *

<VirtualHost *>
ServerName domain1.com
ServerAlias *.domain1.com
ServerAdmin me@domain1.com
DocumentRoot /var/www/html/domain1.com
</VirtualHost>

<VirtualHost *>
ServerName domain2.com
ServerAlias *.domain2.com
ServerAdmin me@domain2.com
DocumentRoot /var/www/html/domain2.com
</VirtualHost>

<VirtualHost *>
ServerName domain3.us
ServerAlias *.domain3.us
ServerAdmin me@domain1.com
DocumentRoot /var/www/html/domain3.us
</VirtualHost>
-----------------------------
hmmmmm

trickykid 07-08-2003 02:25 PM

And like david_ross mentioned, you do have your DNS server pointing to correct IP these are hosted on, etc?

Spaz17 07-08-2003 02:28 PM

yup dns is correct
all my sites work when i set them up as default hosts
and use no virtual hosts

Spaz17 07-08-2003 02:32 PM

when i do it with webmin
: which i dont want to use if i dont have to :
it does it somewhat differently
<VirtualHost domain1.com>
instead of
<VirtualHost *>
but it still doesnt work..

trickykid 07-08-2003 02:37 PM

What happens when you have the virtual hosts defined like above and try to ping one of your domain names by name, does it resolve to the IP address?

Yah, either usually works with the <VirutalHost * or domain.com>
I use the * myself with my virtual hosts.

Spaz17 07-08-2003 02:39 PM

i am able to find them when pinging
i should have mentioned
i can go to each site, but i get an
error 400
bad request

trickykid 07-08-2003 02:50 PM

How are you typing these in your browser? Cause a 400 error means its being sent usually without a hostname, etc in the http request?

Have you tried: http://domain1.com ?

Since I noticed you have a *.domain1.com as well.. etc for all the others. Are you trying to type in a www in the front of each domain name?

If so, have you tried actually adding a virtual host with www.domain1.com as a separate virtual host?

Example:

<VirtualHost *>
ServerName www.domain1.com
ServerAdmin me@domain1.com
DocumentRoot /var/www/html/domain1.com
</VirtualHost>

david_ross 07-08-2003 02:50 PM

Take a look at your error_log for more info.

trickykid 07-08-2003 02:55 PM

A snippet from my httpd.conf file and virtual hosts:

<VirtualHost *>
ServerAdmin webmaster@domain.com
DocumentRoot /data/www/htdocs
ServerName domain1.org
</VirtualHost>

<VirtualHost *>
ServerAdmin webmaster@domain.com
DocumentRoot /data/www/htdocs
ServerName www.domain1.org
</VirtualHost>

<VirtualHost *>
ServerAdmin webmaster@domain2.com
DocumentRoot /data/www/domain2
ServerName domain2.com
</VirtualHost>

<VirtualHost *>
ServerAdmin webmaster@domain2.com
DocumentRoot /data/www/domain2
ServerName www.domain2.com
</VirtualHost>

I think the problem may be the * wildcards you have setup for the aliases.. not sure off top of my head though.

david_ross 07-08-2003 02:57 PM

Without trying to overload you with ideas, you may want to check you VHOSTS config using:
/path/to/httpd -t -D DUMP_VHOSTS

cyph3r7 07-08-2003 03:23 PM

Hey dude take a look at my doctored httpd.conf file. I run about 30 virtual hosts, this is just a snipet to help you understand. First the "*" wildcard needs to be the base IP your DNS will be looking for. Seconde you need to specify the NamedVirtualHost as that IP also. Take a look:

# VirtualHost: Allows the daemon to respond to requests for more than one
# server address, if your server machine is configured to accept IP packets
# for multiple addresses. This can be accomplished with the ifconfig
# alias flag, or through kernel patches like VIF.

# Any httpd.conf or srm.conf directive may go into a VirtualHost command.
# See also the BindAddress entry.

NameVirtualHost 192.168.132.170

<VirtualHost 192.168.132.170>
ServerAdmin me@mydomain.com
DocumentRoot /home/www/extranet
ServerName extranet.mydomain.com
#ErrorLog logs/host.some_domain.com-error_log
#TransferLog logs/host.some_domain.com-access_log
</VirtualHost>

<VirtualHost 192.168.132.170>
ServerAdmin me@mydomain.com
DocumentRoot /home/www/web2
ServerName web2.mydomain.com
ErrorLog logs/host.some_domain.com-error_log
TransferLog logs/host.some_domain.com-access_log
</VirtualHost>


<VirtualHost 192.168.132.170>
ServerAdmin me@mydomain.com
DocumentRoot /home/www/web3
ServerName web3.mydomain.com
ErrorLog logs/host.some_domain.com-error_log
TransferLog logs/host.some_domain.com-access_log
</VirtualHost>

<VirtualHost 192.168.132.170>
ServerAdmin me@mydomain.com
DocumentRoot /home/www/web4
ServerName web4.mydomain.com
ErrorLog logs/host.some_domain.com-error_log
TransferLog logs/host.some_domain.com-access_log
</VirtualHost>


Even though mine are sub domains, that is just how they are aliased in DNS. You could name them whatever you wanted.

Good luck!

Spaz17 07-08-2003 03:43 PM

nothing seems to be working
even when i use only the one virtual host, i get an error 400
should i have the default server with the same config as the first virtual server?


All times are GMT -5. The time now is 11:49 PM.