Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hi, this is my first post, hope you have patience about my novice skills :P

I try to configure my apache2 server (ubuntu) using NameVirtualHost. At this moment i have 3 domains pointing at my static ip; domain1.dyndns.org, domain2.com, domain3.com

My wish is that domain2.com and domain3.com will be configured as Virtualhost pointing to their special directory. All other HTTP-requests like accessing my router (domain1.dyndns.org:8080) remote will be pointed to the domain1.dyndns.org and accessed from there.

For now i have a issue from the apache-server when restarting and i cant see the problem, notice i dont have the default file enabled, only domain2.com and domain3.com, if i enable default the other domains points to my www directory, i still dont understand the problem:

/etc/init.d/apache2 restart
* Restarting web server apache2                                                
[Wed Jul 06 13:16:24 2011] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
... waiting [Wed Jul 06 13:16:26 2011] [warn] _default_ VirtualHost overlap on port 80, the first has precedence

This is my configuration right now:

ports.conf:

Listen 80
Listen 443

/Sites-available/default:

<VirtualHost _default_:80>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

/Sites-available/domain2.com:

<VirtualHost *:80>
ServerName domain2.com
ServerAlias www.domain2.com
ServerAdmin contact@domain2.com
DocumentRoot /var/www/domain2.com/

<Directory /var/www/domain2.com/>
Order Deny,Allow
Allow from all
# Don't show indexes for directories
Options -Indexes
</Directory>
</VirtualHost>

/Sites-available/domain3.com:

<VirtualHost *:80>
ServerName domain3.com
ServerAlias www.domain3.com
ServerAdmin contact@domain3.com
DocumentRoot /var/www/domain3.com/

<Directory /var/www/domain3.com/>
Order Deny,Allow
Allow from all
# Don't show indexes for directories
Options -Indexes
</Directory>
</VirtualHost>
share|improve this question
    
I still have problem with the ports, I put NameVirtualHost *:80 in my ports.conf and it works well without any warnings but the other problem is still there. I want my domain1.dyndns.org take care of all service requests as domain1.dyndns.org:8080 instead of domain2.com:8080 etc. I dont understand how to configure this. –  Henric Jul 14 '11 at 12:45

1 Answer 1

In your /etc/apache2/ports.conf file ensure that you have a NameVirtualHost statement. This tells Apache that it should expect virtual hosts on the designated IP address or all addresses * and port.

NameVirtualHost *:80
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.