1

I have a domain hosted at Godaddy adn hosting at Linode. I added attached screen shot is my DNS settings. Blue highlighted area is where I put my hosting server's IP enter image description here

Now I have 3 sites to be accessed on my server

  • domain.store
  • admin.domain.store
  • operator.domain.store My main domain has a DOT in it, like domain.store would be my main doamin.

In Apache, I created 3 different conf files

  • 000-default.conf
  • myproj-admin.conf
  • myproj-operator.conf

contents of each file is same, (pointed to their respective directories).

000-default.conf

<VirtualHost *:80>


        ServerName www.admin.domain.store

        ServerAdmin webmaster@domain.store

        # Change the paths below to the project document root such as /var/www/project1.

        DocumentRoot /var/www/adminProject/public

        <Directory /var/www/adminProject/public>
                Options -Indexes +FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>

        # Set Default Log Paths

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

</VirtualHost>

In each configuration file, I have pointed them to their respective directories. I did a2ensite and service apache2 restart and when I go to my domain and sub-domains, it loads the contents from only the main folder i.e. the directory where the 000-default.conf is pointed

baig772
  • 111
  • 2

1 Answers1

0

If Apache httpd cannot match the hostname in the Host: header to a ServerName or ServerAlias in your configuration then it will serve up the contents of the default virtual host. The default virtual host is normally the first one defined.

user9517
  • 114,104
  • 20
  • 206
  • 289
  • Could you please elaborate more on this? I am not a server guy and I did this with the help of google. How can I correct or check the host:header? – baig772 Aug 27 '16 at 10:06
  • 2
    Nah, I can't be bothered reading the manuals for you. Perhaps you need to read more on how name based virtual hosting works. – user9517 Aug 27 '16 at 10:41