Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problems with virtualhost
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Sun Feb 18, 2007 3:47 pm    Post subject: Problems with virtualhost Reply with quote

Hi!

I'm having problems setting up virtualhost.

I've got two domains which points on my server dyndns host.

They both worked, but after a reboot, the second domain points to default one.

What am I doing wrong?

This is my 00_default_vhost.conf:
*see below*


Last edited by zeuz on Mon Feb 19, 2007 10:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
thecooptoo
Veteran
Veteran


Joined: 27 Apr 2003
Posts: 1353
Location: UK

PostPosted: Sun Feb 18, 2007 6:38 pm    Post subject: Reply with quote

take the comments out of your config file post
do
grep ^[A-Za-z0-9] /etc/apache...../../vhosts.conf

and then replace whats there with this

it will be much easier to see whats going on
_________________
join the optout - http://nhsconfidentiality.org
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Mon Feb 19, 2007 10:05 pm    Post subject: Reply with quote

Sorry about that. I've only added the second virtual host.

Code:

NameVirtualHost *:80

<IfDefine DEFAULT_VHOST>
<VirtualHost *:80>
    DocumentRoot "/var/www/localhost/htdocs"

    <Directory "/var/www/localhost/htdocs">
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    <IfModule peruser.c>
        ServerEnvironment apache apache
        MinSpareProcessors 4
        MaxProcessors 20
    </IfModule>

    <IfModule itk.c>
        AssignUserID apache apache
        MaxClientsVHost 50
    </IfModule>
</VirtualHost>
</IfDefine>

<VirtualHost *:80>
    ServerAdmin webmaster@domain.se
    DocumentRoot /var/www/domain.se/htdocs
    ServerName domain.se
    ErrorLog /var/log/apache2/domain.se-error_log
    CustomLog /var/log/apache2/domain.se-access_log common
</VirtualHost>
Back to top
View user's profile Send private message
thecooptoo
Veteran
Veteran


Joined: 27 Apr 2003
Posts: 1353
Location: UK

PostPosted: Tue Feb 20, 2007 5:10 pm    Post subject: Reply with quote

try commenting out the IFDefine directives, or move the closing one to the very end ( ie including both vhosts definitions ) and then restart apache
_________________
join the optout - http://nhsconfidentiality.org
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Fri Feb 23, 2007 10:45 pm    Post subject: Reply with quote

When I comment out the <ifdefine>-lines none of the domains work. If i put hte ifdefine bracket around both of them it still behaves as before, both domains points to the default one.

Last edited by zeuz on Fri Feb 23, 2007 10:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
thecooptoo
Veteran
Veteran


Joined: 27 Apr 2003
Posts: 1353
Location: UK

PostPosted: Fri Feb 23, 2007 10:49 pm    Post subject: Reply with quote

like this
Code:
NameVirtualHost *:80

<IfDefine DEFAULT_VHOST>
<VirtualHost *:80>
    DocumentRoot "/var/www/localhost/htdocs"

    <Directory "/var/www/localhost/htdocs">
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    <IfModule peruser.c>
        ServerEnvironment apache apache
        MinSpareProcessors 4
        MaxProcessors 20
    </IfModule>

    <IfModule itk.c>
        AssignUserID apache apache
        MaxClientsVHost 50
    </IfModule>
</VirtualHost>


<VirtualHost *:80>
    ServerAdmin webmaster@domain.se
    DocumentRoot /var/www/domain.se/htdocs
    ServerName domain.se
    ErrorLog /var/log/apache2/domain.se-error_log
    CustomLog /var/log/apache2/domain.se-access_log common
</VirtualHost>


</IfDefine>


_________________
join the optout - http://nhsconfidentiality.org
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Fri Feb 23, 2007 10:55 pm    Post subject: Reply with quote

Just tried that and I also double checked the values, still doesn't work. :( One crazy thing I noticed is that the second domain returns another ip-address when I ping it. How could that be when it points on my server?
Back to top
View user's profile Send private message
thecooptoo
Veteran
Veteran


Joined: 27 Apr 2003
Posts: 1353
Location: UK

PostPosted: Fri Feb 23, 2007 10:58 pm    Post subject: Reply with quote

whats in the log files when you access the pages ?
_________________
join the optout - http://nhsconfidentiality.org
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Fri Feb 23, 2007 11:10 pm    Post subject: Reply with quote

Nothing except that the default access_log get hits from both domains. I think i've found the problem though. I'm having trouble pointing the domains with cname to my dyndns host. I've pointed them directly to my ip-address. Just have to wait and see if that changes anything.
Back to top
View user's profile Send private message
thecooptoo
Veteran
Veteran


Joined: 27 Apr 2003
Posts: 1353
Location: UK

PostPosted: Sat Feb 24, 2007 8:18 am    Post subject: Reply with quote

put your domain names in a clients /etc/hosts and point them to your server and see what happens
_________________
join the optout - http://nhsconfidentiality.org
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Sat Feb 24, 2007 10:40 am    Post subject: Reply with quote

Didn't think of that, thanks. I'm still having the same problem though. I've tried with ifdefine on both and only on the first one. No errors in the log files either. :(
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Sun Feb 25, 2007 4:19 pm    Post subject: Reply with quote

Does anyone have any ideas on what I can try to get this to work?
Back to top
View user's profile Send private message
thecooptoo
Veteran
Veteran


Joined: 27 Apr 2003
Posts: 1353
Location: UK

PostPosted: Sun Feb 25, 2007 7:52 pm    Post subject: Reply with quote

does it work using a client /etc/hosts to point he domain name to your server ?

whats the output of
cat /etc/apache2/httpd.conf |grep vhosts

have you allowed access to each document root
eg something like in httpd.conf

Quote:
<Directory /var/www/localhost/htdocs>
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/domain.se/htdocs>
Order allow,deny
Allow from all
</Directory>



_________________
join the optout - http://nhsconfidentiality.org
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Wed Feb 28, 2007 6:49 am    Post subject: Reply with quote

It doesn't work by adding the domains to /etc/host or in windows host-file on another machine.

cat /etc/apache2/httpd.conf |grep vhosts:
Code:

# Please see vhosts.d/00_default_vhost.conf for the default virtual host.
Include /etc/apache2/vhosts.d/*.conf


Added the directory allowance on the second vhost:
Code:

<VirtualHost *:80>
    ServerAdmin webmaster@domain.se
    DocumentRoot /var/www/domain.se/htdocs
    ServerName domain.se
    ErrorLog /var/log/apache2/domain.se-error_log
    CustomLog /var/log/apache2/domain.se-access_log common

    <Directory "/var/www/domain.se/htdocs">
        Options -Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>


Really nice of you to help me thecooptoo. :)
Back to top
View user's profile Send private message
thecooptoo
Veteran
Veteran


Joined: 27 Apr 2003
Posts: 1353
Location: UK

PostPosted: Wed Feb 28, 2007 7:24 am    Post subject: Reply with quote

whats /etc/conf.d/apache2 and do you have vhosts in your USE flags

from the client can you ping your servernames and get the correct Ip address back ?

to check its not a permissions problem find , in /etc/httpd.conf the first Directive
<Directory />

and then change its contents to Allow from All
and then see what happens

if you get your web pages served correctly then its permissions problem

then CHANGE IT BACK and we can sort it out from there
_________________
join the optout - http://nhsconfidentiality.org
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Sat Mar 03, 2007 3:00 pm    Post subject: Reply with quote

/etc/conf.d/apache2:
Code:
APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5"


I didn't have vhost in my USE flags, is it here the problem lies?

Allow from All didn't work either.

I really appreciate that you help me on this. :)

Edit: Reemerged apache with the vhost flag and restarted apache. Didn't work either. :(

Edit2: This is crazy. I added a subdomain to my default domain and copied the vhost code for my second domain and it works?
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Fri Mar 09, 2007 5:45 pm    Post subject: Reply with quote

I'm still having problems with my second domain. thecooptoo has been trying to help without any luck yet. The strange thing is that i've added two subdomains (subdomain to my default domain) and they work with the lines used for my second domain.

Any help is appreciated , thanks.
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Sun Mar 11, 2007 12:44 pm    Post subject: Reply with quote

Okay, now my second domain works if I don't use www, why is that? Solved it by adding yet another vhost with ServerName set to www.domain2.se.
Back to top
View user's profile Send private message
thecooptoo
Veteran
Veteran


Joined: 27 Apr 2003
Posts: 1353
Location: UK

PostPosted: Sun Apr 01, 2007 3:46 pm    Post subject: Reply with quote

sorry -been away and tied up - are you fixed yet ?
_________________
join the optout - http://nhsconfidentiality.org
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Sun Apr 01, 2007 9:06 pm    Post subject: Reply with quote

Yes, everything works now. :) I have to set up two virtual hosts for the standalone domain though. One for domain.se and the other one for www.domain.se. Anyway, it works so i'm happy. :) Thanks for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum