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 ?

Dogomen
  • 43

1 Answers1

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.

pa4080
  • 30,621