I have setup an apache that serves my site in port 80 and 8080 fine. But now I want to move the VirtualHost on 8080 to port 80 in a subdomain.

Here is my sites-available configuration file:

<VirtualHost *:80>
    ServerName www.mysite.me
    ServerAlias mysite.me
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on

    RewriteRule (.events\/+)(.*)$ http://www.mysite.me/evento.php?eventid=$2
    RewriteCond %{HTTP_HOST} ^mysite\.me
    RewriteRule ^(.*)$ http://www.mysite.me$1 [R=permanent,L]

This virtual host does not work:

<VirtualHost *:80>
        ServerName phpmyadmin.mysite.me
        DocumentRoot /var/www/html/phpMyAdmin

If I serve the latter like this:

Listen 8080    
<VirtualHost *:8080>
            ServerName www.mysite.me
            DocumentRoot /var/www/html/phpMyAdmin

It will work.

But I want to use the subdomain (in this case the phpmyadmin.mysite.me).

What am I missing?

  • Your server config is good and should works, i have around 10 sites in different virtual host using this configuration without trouble. Which error message you get in your browser when you try to acces the web site ? What does Apache log say ?
    – Froggiz
    Nov 14, 2015 at 21:29
  • @Froggiz the error I got with curl: Could not resolve host: phpmyadmin.ficaadica.me. Apache does not say anything in the logs.... Just one extra info, I am using the 000-default.conf to held all the hosts
    – Walucas
    Nov 14, 2015 at 21:55
  • The trouble come from your domaine name, or your dns configuration. phpmyadmin.ficaadica.me isn't reachable
    – Froggiz
    Nov 14, 2015 at 22:21

1 Answer 1


As already pointed out in the comments, only configuring the sudomain in virtual host configuration in Apache is one part of the setup. The other part is, you need to properly configure your DNS for that domain too.

You need to add an A or CNAME record pointing to your webserver for the subdomain, so that an nslookup your.sudomain.com will returen your webserver ip address.

The DNS server configuration is dependent on the hosting provider or software that you are using. In most cases if you are not maintaining your own dns servers, you can log into your hosting provider control panel and should be able to add it easily.

Not the answer you're looking for? Browse other questions tagged or ask your own question.