LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   apache config and seperate vhost help.. (https://www.linuxquestions.org/questions/linux-networking-3/apache-config-and-seperate-vhost-help-44276/)

notstrider 02-06-2003 12:13 AM

apache config and seperate vhost help..
 
yeah, hey, my question is, i set up all my virtual hosts to goto seperate domains, but the second virtual host, the index file, is getting redirected to the first virtual host.. is there anyway around this? (i hope that makes sense)

also, i need some help on having separate log files for each domain, just on how to do it, thanks.

born4linux 02-06-2003 12:55 AM

check your DocumentRoot entries.

notstrider 02-06-2003 01:30 AM

my DocumentRoots' are all correct..

born4linux 02-06-2003 02:04 AM

are all sites set up as virtual host? even your 'main site' should be set up as a vhost. if not, all vhosts will point to the index file of the main site.

jharris 02-06-2003 02:26 AM

Re: apache config and seperate vhost help..
 
Quote:

Originally posted by notstrider
yeah, hey, my question is, i set up all my virtual hosts to goto seperate domains, but the second virtual host, the index file, is getting redirected to the first virtual host.. is there anyway around this? (i hope that makes sense)
I take it that you've made sure that the DNS side of things is working? Post the vhost(s) section(s) of httpd.conf so we can see what you've got there.

Quote:

Originally posted by notstrider
also, i need some help on having separate log files for each domain, just on how to do it, thanks.
Try something like this...
Code:

<VirtualHost www.servername.net>
    ServerAdmin webmaster@servername.net
    DocumentRoot /httproot/www.servername.net
    ServerName www.servername.net
    ErrorLog /var/log/www.servername.net-error_log
    CustomLog /var/log/www.servername.net-access_log common
</VirtualHost>

HTH

Jamie...

notstrider 02-06-2003 03:24 AM

<VirtualHost IP.Address.here>
ServerAdmin webmaster@xxxxx
DocumentRoot /httproot/web1
ServerName www.firstdomain.tld
# ErrorLog logs/host.some_domain.com-error.log
# CustomLog logs/host.some_domain.com-access.log common
</VirtualHost>

<VirtualHost IP.Address.here>
ServerAdmin webmaster@xxxxx
DocumentRoot /httproot/web2
ServerName www.seconddomain.tld
# ErrorLog logs/host.some_domain.com-error.log
# CustomLog logs/host.some_domain.com-access.log common
</VirtualHost>

the logs are directed to /var/log/apache/ , but i want them to be directed to the folder where each domain is, like /web/domain1/logs (for domain one) and /web/domain2/logs (for domain two)
i hope that makes sense.. hehe

jharris 02-06-2003 03:32 AM

To get the logs to /web/domain1/logs you simply need to have ErrorLog /web/domain1/logs/some_access-log and ensure that whatever user httpd runs as has the ability to write to this directory.

I've also only played with named virtualhosts not IP addressed based virtual hosts. In which case I'm using
Code:

NameVirtualHost www.mainserver.net

<VirtualHost www.mainserver.net>
    ServerAdmin webmaster@mainserver.net
    DocumentRoot /raid/htdocs
    ServerName www.mainserver.net
</VirtualHost>

<VirtualHost www.virtualdomain.net>
    ServerAdmin virtual@virtualdomain.net
    DocumentRoot /raid/virtualdomian.net
    ServerName www.virtualdomain.net
    ErrorLog /var/log/virtualdomain-error_log
    CustomLog /var/log/virtualdomain-access_log common
</VirtualHost>

Remember to apachectl restart or (if you want to be nice) apachectl graceful after any changes.

HTH

Jamie...

notstrider 02-06-2003 11:34 AM

i had changed the IP address' to the actual virtual host, it restarts fine, but it's not reading seperate log files for the domains, and the second web domain is reading the index file for the first domain.. heh

*had to edit a word out, since it made no sense* heh.

notstrider 02-07-2003 01:08 AM

ah, nevermind, it's working all good now, i guess i had to wait for my name server to update or something.. hehe, thanks a lot guys.. helped me a lot.

jharris 02-07-2003 02:09 AM

I've had to wait for DNS records to propagate in the past. Glad its working.

Jamie...


All times are GMT -5. The time now is 06:10 PM.