3

When I try to reach the site with my IP it works fine but when I try to use my domain name to connect I get "404 Not Found".
I am on Ubuntu Server 16.04.1 LTS

/etc/hosts/

127.0.0.1       localhost
127.0.0.1       zbytki.cz
127.0.1.1       zbytki.cz
192.168.123.106 zbytki.cz

/etc/apache2/sites-available/zbytki.cz.conf

<VirtualHost *:80>
    ServerAdmin admin@zbytki.cz
    ServerName zbytki.cz
    ServerAlias www.zbytki.cz
    DirectoryIndex index.html
    DocumentRoot /var/www/html/zbytki.cz/public_html
    LogLevel warn
    ErrorLog /var/www/html/zbytki.cz/log/error.log
    CustomLog /var/www/html/zbytki.cz/log/access.log combined
    <Directory "/var/www/html/zbytki.cz/public_html">
          Require all granted
    </Directory>
</VirtualHost>

/etc/hostname

zbytki.cz

/etc/apache2/apache2.conf

...
Timeout 300
...
KeepAlive Off
...
HostnameLookups Off
...
LogLevel warn
...    
AccessFileName .htaccess
...
<IfModule mpm_prefork_module>
     StartServers 4
     MinSpareServers 20
     MaxSpareServers 40
     MaxClients 200
     MaxRequestsPerChild 4500
</IfModule>

/etc/apache2/ports.conf

NameVirtualHost *:80
Listen 80
...

If you need more information just ask.
Can someone please help me ?

  • 1
    Is $ a2ensite zbytki.cz.conf applied? – pa4080 Sep 12 '16 at 17:15
  • yes, site zbytki.cz already enabled – Dogomen Sep 12 '16 at 18:09
  • Did you try to use incognito browser window? I think it should work if you call it up from the same pc. Sometimes previous not successful attempts remains in browser cache. – pa4080 Sep 12 '16 at 18:15
  • I cleared cache in firefox, it doesnt fix my problem. – Dogomen Sep 12 '16 at 18:21
  • I concluded that you are trying to open http://zbytki.cz (http://192.168.123.106) by second PC from your local network - is that true? – pa4080 Sep 12 '16 at 19:29
1

Your web server's configuration is OK. To access certain host via host name, instead of IP-address, you must have pre-configured Domain Name Service / Server (DNS). There is two solutions:

1st. If you want you can configure yours own DNS which you can use in your local network. Here you go the manual - look at Primary Master configuration.

2nd. You can buy (register) a domain name from any DNS provider. This domain will be accessible from the Internet. For example I bought one from host.bg - there has a promotion of .info at the moment.

In this case you will need a (public) static IP-adress or pre-configured Dynamic DNS (DDNS), which will connects your dinamic IP-adress with the domain name.


I've made short survey and I found that domain zbytki.cz is registred from someone - hope that is you.

enter image description here

When I checked with $ nslookup zbytki.cz it returns: ** server can't find zbytki.cz: NXDOMAIN.

So the domain is registered but is not configured to work with certain (static) IP address.

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.