Add a subdomain to my Debian Server

10,343

You are missing some configuration in your virtual host settings.

As explained in Apache docs you need to specify following options for your named virtual host:

ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain

ServerAlias is optional, but usually you will want to use it.

In your case you need to specify:

ServerName vietnam.mysite.net
DocumentRoot /var/www/vietnam.mysite.net
Share:
10,343

Related videos on Youtube

x_vi_r
Author by

x_vi_r

Web Developer - CLi Addict - DataLover

Updated on September 18, 2022

Comments

  • x_vi_r
    x_vi_r over 1 year

    I created a subdomain of a ndd i got with the A and i redirect it to my server with the IP

    On my server i created an apache file to redirect that subdomain to the correct directory. Here is the config file - located in /etc/apache2/sites-avalaible/vietnam/

    <VirtualHost*:80>                                                                                                                                                                                                      DocumentRoot /var/wwwvietnam.mysite.net                                                                                                                                          
      <Directory /var/www/vietnam.mysite.net/>                                                                                                                                          
        Options Indexes FollowSymLinks MultiViews 
                    AllowOverride All
                    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}/vietnam_error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog ${APACHE_LOG_DIR}/vietnam_access.log combined
     </VirtualHost>
    

    Then i added the config with

    a2ensite vietnam
    

    And i change the /etc/hosts with my subdomain name like this

    11.22.33.44 vietnam.mysite.net
    

    The thing is, when i open the vietnam.mysite.net in my browser it show the index.html located in the /var/www directory (ie the default file) it looks like apache don't understand the conf...

    Any tips .