1

I must be missing something here... I've created a conf file here:

/etc/apache2/sites-available/mysite.lee.conf

Which contains:

<VirtualHost *:80>
    ServerName mysite.lee
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/mysite

    ErrorLog ${APACHE_LOG_DIR}/error_mysite.log
    CustomLog ${APACHE_LOG_DIR}/access_mysite.log combined

</VirtualHost>

I've then run:

a2ensite mysite.lee.conf

Followed by:

systemctl reload apache2

However when I navigate in my browser to mysite.lee I get a This site cannot be reached error.

  • the problem here is that you cannot either invent site names or procedures at random and expect them to work. I would advise you researching about DNS+Apache. The question is overly broard, and denotes a fundamental lack of research. You do have shortcuts to see the site only in your machine, but the DNS question will come shortly thereafter. – Rui F Ribeiro Aug 6 '18 at 12:19
2

If you are using your local machine and want to access the website you enabled by local one, you can simply edit /etc/hosts and add this line into the end of the file:

127.0.0.1        mysite.lee

Also if you are on your virtual web server and want to access to your website, you must add new zone into your DNS server. I don't know which DNS server you are using, if you give me more information, I can update my answer...

  • Hi Hamid, I want everyone on the network to be able to view mysite.lee cat /etc/resolv.conf gives me 192.168.2.1, which is our other server. Does this mean that the DNS is handled by the other server? – Lee Aug 6 '18 at 12:36
  • When we talking about server here, it is not separated machine. in your case, I can give you two solution: 1. Disable all of your websites on Apache web server, then just enable your selected one (mysite.lee). in this case, when others come into your IP, they can see your website, but the domain will not work! 2. you must set a dns server, like bind or tinydns, then add your DNS server into every pc on the network, or add it to your main router. it has too many-complicated ways for reaching your goal in this solution but is a standard one. – Hamid Yousefi Aug 6 '18 at 12:41
  • Thanks Hamid, I've found the DNS settings now so I'm adding the zone. Thanks for your help. – Lee Aug 6 '18 at 12:53

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