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

I currently have a site: 'www.mydomain.com' and want to create a subdomain called 'test.mydomain.com'.

I did the following steps below, but am encountering 2 errors:

1) When I go to 'test.mydomain.com', I get a DNS error.

2) When I ran 'sudo /etc/init.d/apache2 reload', I get the following error msg:

Reloading web server config apache2 apache2: Could not reliably determine the 
server's fully qualified domain name, using X.Y.X.Y for ServerName

Here are the changes I made:

1) /etc/hosts file: localhost localhost.localdomain
X.Y.X.Y www.mydomain.com test.mydomain.com

2) /etc/apache2/sites-available/test.mydomain.com file:

<VirtualHost *:80>
    ServerName test.mydomain.com
    ServerAlias www.test.mydomain.com
    DocumentRoot /var/test/                  
<Directory /var/test/>
        Options Indexes FollowSymLinks MultiViews +Includes
        AllowOverride None
        Order allow,deny
        allow from all
3) /etc/apache2/sites-available/www.mydomain.com file:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    ServerName www.mydomain.com
    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride FileInfo
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride FileInfo
        Order allow,deny
        allow from all

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

    ErrorLog /var/log/apache2/error.log

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

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128


3) I added the following line to the /etc/apache2/sites-available/default file:

ServerName www.mydomain.com

4) Ran the following commands

sudo a2ensite www.mydomain.com
sudo a2ensite test.mydomain.com
sudo /etc/init.d/apache2 reload
share|improve this question

1 Answer 1

DNS error is on the client side. Where did you edit the "/etc/hosts"? You should edit it on the client (the pc where the browser is).

If the problem was with apache, you'd probably get a 404 error or something simmilar, and not a DNS serror.

share|improve this answer
but i need lots of clients that I don't control to be able to access test.mydomain.com. What DNS changes would I need to make? –  JMan Jun 4 '12 at 18:50
you should add an A record (or CNAME) to your DNS. /etc/hosts is okay for testing, but not for 'real' use. –  mulaz Jun 4 '12 at 20:48

Your Answer


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.