A few weeks ago I installed LAMP on Linux Server(Version 4.4.0-24). Apache(Version 2.4.20) works fine and I can access my Apache2 Debian Default Page on Now I want to create virtual hosts so I can start developing. But that is the point where it goes wrong.. I cant access them.. When I go to my virtual host site1.example.com my browser says This site is not accessible and DNS not found.

My Files:


<VirtualHost *:80>
    ServerAdmin webmaster@site1.example.com
    ServerName site1.example.com
    DocumentRoot /var/www/site1.example.com/httpdocs

    <Directory />
            Options FollowSymLinks
            AllowOverride None
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all

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

I enabled this virtual host with sudo a2enssite site1.example.com.conf and reloaded apache. What pretty wierd is when I replace *80 with it works but I can't access the ServerName..

etc/hosts localhost developmentserver

::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

The DNS is not set for site1.example.com at the moment but I've tried it but no results..

Before marking this question as duplicated. I've searched around this forum and other sites for weeks and tried a lot but nothing helped me out.

  - Set DNS in hosts 
  - Many Virual hosts builds
  - Many tutorials

Unfortunately I get no error I can show

I hope someone can help me, thanks in advance

  • Did you set the DNS records on your domain manager to point to your IP address? Subdomains need specific records unless you have a *.domain.com record. Jun 29, 2016 at 20:54
  • @Zacharee1 Where can I set up DNS records? Jun 29, 2016 at 21:15
  • Go to your domain registrar's website and log in? Jun 29, 2016 at 21:16
  • @Zacharee1 I'm just trying to get someting like this tutorial working: digitalocean.com/community/tutorials/… I have no Domain registar website. Jun 29, 2016 at 21:25
  • Then how do you have a domain? Jun 29, 2016 at 21:25

1 Answer 1


You said in the comments you're using an IP address to connect. IP addresses don't have subdomains since they aren't domains in the first place.

http://example. treats example.192.168 as the subdomain and 0.1 as the actual domain. example. will just search that text if you have an omnibar like Chrome.

If you want subdomains and virtual hosts, you need an actual domain. There are free options out there, like Dot TK (Now Freenom). Register something there, then set up CloudFlare to have better DNS management.

  • Thanks for the help. I thought it was possible to run Apache2 on linux server and create vhost like in WAMP but thats something else I think. I know IP address can't have sub domain. I thought the IP address was just like localhost in WAMP Jun 29, 2016 at 22:21
  • You can do virtual hosts, just not with IP addresses. Jun 29, 2016 at 22:21
  • Sorry , I thought it could Jun 29, 2016 at 22:24
  • Like I said in my answer, IP addresses don't have subdomains. I should say, you can do virtual hosts with IPs, but only if you have different IPs for the same computer. Jun 29, 2016 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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