Search code examples
apachednswebservervirtualhost

Virtual Host Apache2 doesn't work


I tried to add an second Domain to my dedicated server. My standard domain 1 should connect to normal /var/www/ path and my second domain should point to /var/www/domain.

Changed some thing (see comments) and now I get an 404 Error

My enabled sites configs look like:

default domain:

ServerAdmin mail@provider.com

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>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

second domain:

<VirtualHost *:80>
ServerName www.second-domain.net
ServerAlias second-domain.net *.second-domain.net
DocumentRoot /www/domain
</VirtualHost>

hosts Document:

fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
2a06:1c40::xxx k4lim
::1 localhost

127.0.0.1       localhost
127.0.0.1       domain1.name
185.101.92.XXX  domain2.name

T he error I get when I try to open the site in Firefox is: The DNS Adress of the domain could not be found.

Would be really thankful for any ideas and help!


Solution

  • I just found my problem:

    <VirtualHost *:80>
    ServerName www.second-domain.net
    ServerAlias second-domain.net *.second-domain.net
    DocumentRoot /www/domain
    </VirtualHost>
    

    I forgot the /var/.... before /www/domain