How to add a domain name in local with Apache?

Viewed 2284

I have a website which I used to deploy in localhost running the command: sudo /etc/init.d/apache2 start and then typing the URL: http://XXX/myfirstphpsite/src where XXX is my IP address and myfirstphpsite/src the repertory containing my website.

However, now I want to type the following URL: http://pharaohohparis.tld instead of the last URL to deploy in local my website.

For that, I did the following:

  1. I went to the repertory: /etc/apache2/sites-available/ and created a new file named: pharaohofparis.tld.conf in which I inserted:

    <VirtualHost *:80>
        ServerName pharaohofparis.tld
        DocumentRoot /var/www/html/myfirstphpsite/src
    
        <Directory /var/www/html/myfirstphpsite/src>
            Options Indexes FollowSymLinks Includes
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
    
  2. I actived the virtual host by typing:

sudo a2ensite pharaohofparis.tld.conf
sudo service apache2 reload

  1. I edited the file /etc/hosts by adding the line:
127.0.0.1       pharaohofparis.tld

However, when I type the URL: http://pharaohofparis.tld, I got the DNS error "DNS_PROBE_FINISHED_NXDOMAIN". How can I fix this ?

EDIT: THE PROBLEM WAS LINUX SUBSYSTEM. THERE WAS NO PROBLEM IS A REAL UBUNTU.

1 Answers

As I said in my Edit above: the problem was apparently Linux Subsystem. There was no problem is a real Ubuntu.

Related