-2

I have two websites:

iq-dev.de and iq-dev.com

iq-dev.de works without a problem and is also available through www.iq-dev.de. I have a cloud Server with linux installed and edit everything via ssh.

My hostname is "thor" and I tried:

  • Adding iq-dev.com to my hosts file
  • Adding iq-dev.com as "sites-enabled" / "sites-available" in the apache2 files

My hosts looked like this:

127.0.0.1       localhost localhost
82.223.17.182 iq-dev.com thor
82.223.17.182 iq-dev.de thor

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

In my Sites Available and Sites Enabled I added the file iq-dev.com.conf with these settings:

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port t$
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        ServerName iq-dev.com
        ServerAlias www.iq-dev.com
        DocumentRoot /var/www/iq-dev.de/main

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
#LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Can anyone tell me where I went wrong? I really don't get what to do now. I searched different tutorials for the hosts file and sites-available/sites-enabled but I can't see anything wrong.

What I want to do of course is just to have iq-dev.com resolve to the same folder as iq-dev.de.

2 Answers2

1

If you want the same content on both the websites then edit the configuration file of "iq-dev.de" add the following:

ServerAlias iq-dev.com, www.iq-dev.com
Nidhi
  • 111
  • 3
  • Note: You should edit the "hosts" file on your own local machine. Not on the server. The hosts file on your local PC should contain the line `82.223.17.182 iq-dev.com` as currently there is no "A" or "CNAME" DNS record for this domain. – Nidhi Apr 09 '16 at 16:00
  • I already tried the ServerAlias thing in 000-default.conf and iq-dev.de.conf and restarted apache, it didn't work. So I guess the main problem is to set the A or CNAME DNS record? – Frederik Witte Apr 09 '16 at 16:46
  • Thank you for the info though :) – Frederik Witte Apr 09 '16 at 16:49
1

You don't have a DNS A record set for iq-dev.com

Contact your domain provider to point the domain to your webserver

Colt
  • 2,029
  • 6
  • 21
  • 27
  • Hey man, I just found out that I can edit the DNS Settings by myself and you are right, the Website just wasn't pointed to my webserver! Thank you so much! I was already so frustrated – Frederik Witte Apr 09 '16 at 16:49