'using domain name in localhost

i have problem to using domain name in localhost
i'm using windows 8.1 64 bit and my xampp in drive F

i'm already edit httpd.conf in F:\xampp\apache\conf to load vhost

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

already edit too httpd-vhosts.conf in F:\xampp\apache\conf\extra

NameVirtualHost *:80
<VirtualHost *:80>
   DocumentRoot "F:/xampp/htdocs/itklan/public/"
   ServerName mydomain.dev
   ServerAlias mydomain.dev
     <Directory "F:/xampp/htdocs/itklan/public/">
        Order allow,deny
        Allow from all
     </Directory>
</VirtualHost>

i'm adding to host in C:\Windows\System32\drivers\etc

# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
    127.0.0.1       mydomain.com

already restart apache...and i even restart my windows

but i still get something like this in google chrome

This webpage is not available
ERR_CONNECTION_REFUSED

hm where i'm missing?
ps : i still can access http://localhost:8080/itklan/public/ normaly


update

when i try to ping mydomain.dev it's success receiving all data from my localhost ip like this

enter image description here

and i test to run 127.0.0.1 it's showing

This webpage is not available
ERR_CONNECTION_REFUSED

of cource because i change my apache port to 8080 and mysql port to 4433
so it's should 127.0.0.1:8080 to open xampp home page

based on this page -> thanks to abdula
i try to edit 'httpd-vhosts.conf' and make it listen port 8080
but when i add script Listen 8080 my apache wont run again
i tried to change that script to Listen 80 and it's make my apache can running again. i notice if apache open ports now become 3 (80, 8080, 4433) so i guess i don't need to add Listen 8080 again because my apache already listen to that port
so i just changed the rest like this

NameVirtualHost *:8080
<VirtualHost *:8080>
   DocumentRoot "F:/xampp/htdocs/itklan/public/"
   ServerName mydomain.dev
</VirtualHost>

and in hosts file

# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
    127.0.0.1  mydomain.dev

but it's still same



Solution 1:[1]

Don't use .com domain. use .dev or something which not available

and try this host

<VirtualHost mydomain.dev>    
    DocumentRoot F:/xampp/htdocs/itklan/public/  
    ServerName mydomain.dev
    ServerAlias server  
</VirtualHost> 

VirtualHost Examples


EDIT 01

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot F:/xampp/htdocs/itklan/public/  
ServerName mydomain.dev
</VirtualHost>

Solution 2:[2]

It might sound silly or unlikely, but you didn't seem to mention checking your Firewall settings.

Though you're conceptually connecting to yourself, port 80 and 443 can have different restrictions by default and you may want to try allowing inbound ports for TCP or UDP whichever is suitable for your needs.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Doedigo