PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, September 20, 2022

[FIXED] How to add a domain name in local with Apache?

 September 20, 2022     apache, domain-name, localhost, virtualhost     No comments   

Issue

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.


Solution

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



Answered By - PharaohOfParis
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing