Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.

How to set a domain to ip address?
You can reach this IP address 2.186.116.46 (if my computer is online). I want to assign a domain to it so I wonder how is that possible when I have no DNS? I do own my domain which is ".com". My IP is static.

- 1 There are a lot of free DNS providers. If you don't want to use them, you'll need to edit the /etc/hosts file on each computer that uses the IP address. – zondo Apr 5, 2017 at 17:15
- So how can I use them? – Shadow4Kill Apr 5, 2017 at 17:24
- 1 It looks like you using Apache/2.4.7. So in short: 1st you have to acquire FQDN from some DNS provider . 2nd: you must setup a ServerName directive into your /etc/apache2/sites-available/your-virtualhost.conf file. – pa4080 Apr 5, 2017 at 17:42
- 1 If this is just for your use, I highly recommend freedns.afraid.org . You can either use a custom domain that you get elsewhere, or you can take a subdomain of any of their thousands. The guy who runs it is also very friendly and has helped me with some of my DNS problems. – zondo Apr 5, 2017 at 18:25
2 Answers 2
1. You need to acquire a domain name (or maybe just FQDN ) from some DNS provider .
2. Once you have registered the domain name, you will gain access to an administrative panel (like this one shown below), where you will be able (via A records), to redirect the domain name (and all *. or certain sub domains / FQDNs) to your server's IP address.

Please note that the provider's administrative panel shall looks different, and the provider will give you exact instructions how to use it.
Sometimes the redirection can take up-to 24 hours. You can check if it's successful by the command whois example.com .
If the server is behind NAT, you must setup port forwarding .
3. Edit your Virtual Host configuration file and add relevant ServerName and maybe ServerAlias directives. Let's assume the configuration file is 000-default.conf that should look as this:
This step can be omitted, but it is absolutely necessary when you have more than one Virtual Hosts .
Don't forgot to:
4. In addition for local needs :
You can bind a FQDN to the loopback interface of the server. For this purpose, edit the file /etc/hosts in a way like this:
It is not possible to enter *.example.com here. You can add an entry also for the IP address of another (local) server's network interface - for example 77.77.77.70 .
If you want to access the FQDN by another computer through the LAN (or by a private computer through Internet), edit its host file in a way like this:
Further reading:
Creating additional virtual host Ubuntu Server 16.04.3
Connect via ssh to one of the multiple clients on same network

- Maybe this answer could be interesting for you. – pa4080 Apr 5, 2017 at 22:29
- Thanks for your answer. But editing my /etc/hosts will only make domain available for my home network I want to set domain for public internet connection. I now got two DNS: herahost1.ddns.net herahost2.ddns.net shall I set them to my domain? But when I even do it the domain won't redirect to my site! – Shadow4Kill Apr 6, 2017 at 6:28
- Thanks, Would you please give an screenshot of your sub domain setting which you set it to mine? – Shadow4Kill Apr 6, 2017 at 7:24
- Thanks for your kindness, I exactly did right that but it's not working. And my bigger problem is that what shall I set the DNS of my domain. when I try to set them in herahost1.ddns.com and herahost2.ddns.com which are set to my ip it says something went wrong! – Shadow4Kill Apr 6, 2017 at 8:38
- And this is my screen of settings link – Shadow4Kill Apr 6, 2017 at 8:43
If it is for just local use, you can just put that entry into your hosts file.
On modern Windows, that is usually c:\Windows\System32\Drivers\etc\hosts .
On Linux, the file is /etc/hosts .
For the rest of the world, use one of the freely available DNS providers.
Here is an example, with instructions: FreeDNS
Not the answer you're looking for? Browse other questions tagged networking apache2 dns or ask your own question .
- The Overflow Blog
- How Intuit democratizes AI development across teams through reusability sponsored post
- The nature of simulating nature: A Q&A with IBM Quantum researcher Dr. Jamie...
- Featured on Meta
- We've added a "Necessary cookies only" option to the cookie consent popup
- Announcement: AI-generated content is now permanently banned on Ask Ubuntu
Hot Network Questions
- What sort of strategies would a medieval military use against a fantasy giant?
- If you order a special airline meal (e.g. vegan) just to try it, does this inconvenience the caterers and staff?
- How can I explain to my manager that a project he wishes to undertake cannot be performed by the team?
- How to make graphons pictures?
- Why does Jesus turn to the Father to forgive in Luke 23:34?
- Why is this sentence from The Great Gatsby grammatical?
- OK to delete Windows.db file on PC?
- What can a lawyer do if the client wants him to be acquitted of everything despite serious evidence?
- Book about a good dark lord, think "not Sauron"
- Do you really get double penalized for rolling HSA excess contributions to the next year?
- How to use Multiwfn software (for charge density and ELF analysis)?
- Does Counterspell prevent from any further spells being cast on a given turn?
- How to change the styles of Real part and Imaginary part in ReImPlot using ReImStyle?
- Calculating probabilities from d6 dice pool (Degenesis rules for botches and triggers)
- Replacing broken pins/legs on a DIP IC package
- "We, who've been connected by blood to Prussia's throne and people since Düppel"
- Small bright constellation on the photo
- Copyright issues when journal is defunct
- Lots of pick movement
- How does fire heat air?
- How do you get out of a corner when plotting yourself into a corner
- What's the difference between a power rail and a signal line?
- Largest Binary Area
- Mini project #2: Guessing a number loop
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .
Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Change IP to domain name on linux
How is that we can convert an IP to a domain name address on linux machine.
Suppose i always access my Pc with http://127.0.0.1 from the browser
I want to change this to my.com
- domain-name
- 3 This belongs on superuser. But take a look at man hosts – balpha ♦ Jan 8, 2010 at 6:11
3 Answers 3
you can add a line like
to /etc/hosts if you want to bind a hostname to an IP. In most default configurations this file is consulted first.
I'n not sure exactly what you're asking, but if you just want to know how to look up a domain name associated with an IP address, you can use dig -x to do a reverse DNS lookup :
Note that this won't always work, because there may be multiple domain names pointing at a single IP address, and it's not always the case that every IP address has a reverse DNS mapping.
You should already be able to access that via http://localhost/ , which is the standard name for 'this machine'.
Your Answer
Sign up or log in, post as a guest.
Required, but never shown
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 linux ip domain-name or ask your own question .
- The Overflow Blog
- How Intuit democratizes AI development across teams through reusability sponsored post
- The nature of simulating nature: A Q&A with IBM Quantum researcher Dr. Jamie...
- Featured on Meta
- We've added a "Necessary cookies only" option to the cookie consent popup
Hot Network Questions
- Why doesn't the federal government manage Sandia National Laboratories?
- If a law is new but its interpretation is vague, can the courts directly ask the drafters the intent and official interpretation of their law?
- If you order a special airline meal (e.g. vegan) just to try it, does this inconvenience the caterers and staff?
- How many "grounds" are there and what is the difference?
- "Users & Groups" does not display groups on Ventura 13.2
- Stats update during Index rebuild
- Why do many companies reject expired SSL certificates as bugs in bug bounties?
- Small bright constellation on the photo
- Atheists who follow the teachings of Jesus
- FAA Handbooks Copyrights
- Acidity of alcohols and basicity of amines
- MAGENTO 2: PHP Parse error: syntax error, unexpected 'MageSuite' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) ... on line 7
- Is it correct to use "the" before "materials used in making buildings are"?
- BASIC line input buffer location on ZX Spectrum
- OK to delete Windows.db file on PC?
- Did any DOS compatibility layers exist for any UNIX-like systems before DOS started to become outmoded?
- Differential Input to ADC Depends on Mac vs Windows Laptop USB Power (ADS1115)
- Copyright issues when journal is defunct
- Largest Binary Area
- 2000s era show about a group of friends who used a remote to open a portal anytime they needed to escape from aliens or creatures
- Replacing broken pins/legs on a DIP IC package
- The region and polygon don't match. Is it a bug?
- Experiment to crush soda can by air pressure
- Recovering from a blunder I made while emailing a professor
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .
- Articles Automation Career Cloud Containers Kubernetes Linux Programming Security
- About About Enable Sysadmin Email newsletter Join the community Sudoers program Meet the team FAQs
How to use the Linux BIND command to install and configure DNS
%t min read | by Ashish Bharadwaj Madabhushana (Red Hat)

Photo by Alexander Andrews on Unsplash
The Domain Name System (DNS) is used to resolve (translate) hostnames to internet protocol (IP) addresses and vice versa. A DNS server, also known as a nameserver , maps IP addresses to hostnames or domain names.
In this article, you will learn the basics of DNS, from how DNS gets the IP address and hostname, to the concepts of forward and reverse lookup zones. It will also show you how to install and configure DNS, define and edit zone files, and verify whether the DNS can resolve to the correct address with the help of commands. If you are new to DNS, this article will help you play with it on your system using basic configurations.
How DNS works
When a client requests information from a nameserver, it usually connects to port 53, and then the nameserver resolves the name requested.

- Getting a response from the DNS server to the DNS client is called a lookup response .
- The system on which the DNS service is configured is called a DNS server .
- The system that accesses the DNS server is called a DNS client .
Where does DNS get IP addresses?
You might wonder how DNS gets the IP of the corresponding hostname or domain name. How does DNS search among different IP addresses and associate your domain name correctly? Who stores those mappings between domain names and IP addresses?
The DNS workflow illustrates how communication happens within DNS and how it resolves the addresses.

- When the client searches for the domain www.example.com , the request will initially go to the internet service provider's (ISP) resolver. It will respond to the user's request to resolve a domain name.
- If the IP address is not found on the resolver, the request is forwarded to a root DNS server and later to the top-level domain (TLD) servers.
- TLD servers store information for top-level domains, such as .com or .net .
- Requests are forwarded to the nameservers, which know detailed information about domains and IP addresses.
- Nameservers respond to the ISP's resolver, and then the resolver responds to the client with the requested IP.
- When the resolver doesn't know the IP, it stores the IP and its domain in a cache to service future queries.
[ Download now: A system administrator's guide to IT automation . ]
Forward and reverse lookups
The forward lookup zone uses the domain name to search for IP addresses, whereas the reverse lookup zone uses IP addresses to search for the domain name.

Install and configure DNS
BIND is a nameserver service responsible for performing domain-name-to-IP conversion on Linux-based DNS servers.
The BIND package provides the named service. It reads the configuration from the /etc/named and /etc/named.conf files. Once this package is installed, you can start configuring DNS.
Configure the /etc/named.conf file
First, add or edit the two values in the options field. One is the DNS server address, and the other is the allow-query to any .
Here are the values from the above file:
- 192.168.25.132 – DNS server address
- any – matches every IP address
Define the forward and reverse zones
Define the forward and reverse zones in the /etc/named.conf or /etc/named.rfc1912.zones (you can define zones in either of those files). In this example, I am appending zone definition details to the /etc/named.rfc1912.zones file.
Create forward and reverse zone files
You also need to create forward and reverse zone files in the /var/named directory.
Note : By default, the named.conf file includes the /var/named directory for checking zone files. Sample zone files named.localhost and named.loopback are created during the installation of the BIND package.

Add the nameserver IP to /etc/resolv.conf
First, you must disable DNS processing by NetworkManager because it dynamically updates the /etc/resolv.conf file with DNS settings from its active connection profiles. To disable this and allow manual editing of /etc/resolv.conf , you must create a file (For example, 90-dns-none.conf ), as root in the /etc/NetworkManager/conf.d/ directory that contains the following:
Save the file and reload (restart) NetworkManager.
After you reload NetworkManager, it won't update /etc/resolv.conf . Now, you can manually add the nameserver's IP address to the /etc/resolv.conf file.
[ Be prepared in case something goes wrong. Read An introduction to DNS troubleshooting . ]

Start/restart and enable the named service
If the named service is not running or is disabled, then start and enable it. If it is already active (running) and you made all these configurations, you need to restart the service to make changes.
Verify the DNS name resolution
You have installed the BIND package, configured named files, created lookup zones, and restarted the service to make configurations take effect. Now use the nslookup and dig commands to check whether DNS is working properly and verify whether you are getting the intended results.
- nslookup is a program to query internet domain name servers.
- dig is a tool for interrogating DNS servers. It performs DNS lookups and displays the answers that are returned from the nameserver.
Query with nslookup
Query with dig.
Here is a forward lookup, where DNS responds with 192.168.11.132 as an IP for servera.example.com :
This example displays a reverse lookup, where the DNS server responds with servera.example.com as the domain name for 192.168.25.132 :
[ Network getting out of control? Check out Network automation for everyone , a free book from Red Hat. ]
In this article, you learned what DNS is and how it works. Also, you now know what forward and reverse lookup zones are and how they work. You also learned how to install the BIND package, which is responsible for setting up DNS on the system and configuring the named files and lookup zones. Finally, you learned two commands, nslookup and dig , to interrogate DNS resolutions.
Check out these related articles on Enable Sysadmin

Ashish Bharadwaj Madabhushana
Ashish Bharadwaj is an intern at Red Hat who is passionate about systems administration, networking, and programming. Ashish believes open source is the future and that contributing to the technologies and community is a great way to solve problems efficiently and create new ideas or products. More about me
Try Red Hat Enterprise Linux
Download it at no charge from the red hat developer program., related content.

OUR BEST CONTENT, DELIVERED TO YOUR INBOX
Privacy Statement
Related blogs
How to install free SSL certificate on Nginx web server
How to host a website on Github for free with a custom domain?
How to install Nginx on Red Hat Linux server?
How to build a CLI Tool using Python ?
User guide for deploying the Next.js app in production using PM2 and Nginx?
How to set up a virtual Host on an Nginx?
How to configure Tailwind CSS with Next js ?
How to configure Tailwind CSS with React ?
How to install an Elastic Enterprise Search (Appsearch) on Ubuntu?
How to install Nginx on an Ubuntu server?
How to configure Elasticsearch and Kibana setup
How to Map a domain name with a Linux server using public IP?
2022-10-17T09:33:34.650973Z
Published on

Introduction:
If you have not changed any dns settings after purchasing your domain. then by default, your domain name will be in a parked state . that means when you visit your domain name it will redirect to some sample page without showing a blank page. to change the state of your domain name from parked state to live state . you have to delete an a record ( with fields mentioned as parked on it ) from the dns settings. to read more about dns records click here ., flow diagram:.

Prerequisites:
Purchased domain name linux server with public ip address, step 1: retrieve the public ip address of the linux server., navigate to the dashboard of your linux server and get the public ip address of the server., step 2: navigate to the dns settings of the respective domain name., login to the domain provider account navigate to the dns settings of the respective domain name. note:* in this article, godaddy is used as a domain name provider. , step 3: if your newly purchased domain is parked by default, delete the a record., delete the a record ( with fields mentioned as parked on it ) from the dns settings. for your reference an example screenshot is given below, in this example the domain name provider is godaddy., step 4: create a new a record to link the linux server ip with the domain name., note:* in this article, godaddy is used as a domain name provider. to link your domain name with the linux server ip . create an a record , as shown in the below screenshot. type: a name: @ value: 0.0.0.0 ( enter your linux server ip address, eg: 53.253.23.125 ) ttl: default, note:* to check whether the domain name is linked to the linux server ip, please follow the below steps. install nginx on ubuntu 1 sudo apt update 2 sudo apt install nginx -y copy copy copy copy copy copy copy copy copy copy copy check nginx status by executing the below command, if the status is running you’re ready to go. 1 systemctl status nginx copy copy copy copy copy copy copy copy copy copy copy an example output screenshot is given below. check your domain name is linked to the linux server, by visiting the domain name from a web browser. an example output screenshot is given below..
interested topics
Subscribe to our Newsletter
The latest news, blogs, and fun memes from the community!

Copyright @2022 Episyche Technologies Pvt Ltd

How to get a hostname/domain name from an IP address in Linux
In this short guide, we have explored a few ways to performs Reverse DNS lookup and get a domain name from an IP address. For demonstration purposes, I have used Ubuntu 20.04.
Prerequisites
Before you roll up your sleeves, ensure that your remote host has an A record which is a DNS entry that points or maps a domain name to an IP address
Perform DNS Reverse lookup using dig command
Dig command is a flexible and powerful tool that is used for querying or probing DNS records. It’s an acronym for domain information groper and allows you to retrieve a wide array of DNS information such as A, CNAME, MX, and SOA records.

Perform DNS Reverse lookup using nslookup command
A nslookup command is a troubleshooting tool that features highly in a sysadmin’s armory. It’s a versatile tool that performs all DNS record querying such as CNAME, A, MX, and reverses or PTR records.
To retrieve a domain name from an IP address, use the command syntax:
For example.

Perform DNS Reverse lookup using the host command
Similarly, you can use the host command to obtain a hostname or domain name from an IP address using the syntax as shown.
For example, to check the domain name for the IP 5.9.235.235, execute the command:

Just like the Nslookup command, you can also use the host command with hostnames or IP addresses.
The few examples that we have just elaborated are a sure way of helping you obtain the domain name from an IP address. Usually, the reverse DNS lookup is trivial and not as crucial as the forward lookup, which maps domain names to IP addresses. Your feedback or contribution will be highly welcomed.
About the author

Karim Buzdar
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays .
- Data Structure & Algorithm Classes (Live)
- System Design (Live)
- DevOps(Live)
- Explore More Live Courses
- Interview Preparation Course
- Data Science (Live)
- GATE CS & IT 2024
- Data Structure & Algorithm-Self Paced(C++/JAVA)
- Data Structures & Algorithms in Python
- Explore More Self-Paced Courses
- C++ Programming - Beginner to Advanced
- Java Programming - Beginner to Advanced
- C Programming - Beginner to Advanced
- Android App Development with Kotlin(Live)
- Full Stack Development with React & Node JS(Live)
- Java Backend Development(Live)
- React JS (Basic to Advanced)
- JavaScript Foundation
- Complete Data Science Program(Live)
- Mastering Data Analytics
- CBSE Class 12 Computer Science
- School Guide
- All Courses
- Linked List
- Binary Tree
- Binary Search Tree
- Advanced Data Structure
- All Data Structures
- Asymptotic Analysis
- Worst, Average and Best Cases
- Asymptotic Notations
- Little o and little omega notations
- Lower and Upper Bound Theory
- Analysis of Loops
- Solving Recurrences
- Amortized Analysis
- What does 'Space Complexity' mean ?
- Pseudo-polynomial Algorithms
- Polynomial Time Approximation Scheme
- A Time Complexity Question
- Searching Algorithms
- Sorting Algorithms
- Graph Algorithms
- Pattern Searching
- Geometric Algorithms
- Mathematical
- Bitwise Algorithms
- Randomized Algorithms
- Greedy Algorithms
- Dynamic Programming
- Divide and Conquer
- Backtracking
- Branch and Bound
- All Algorithms
- Company Preparation
- Practice Company Questions
- Interview Experiences
- Experienced Interviews
- Internship Interviews
- Competitive Programming
- Design Patterns
- System Design Tutorial
- Multiple Choice Quizzes
- Go Language
- Tailwind CSS
- Foundation CSS
- Materialize CSS
- Semantic UI
- Angular PrimeNG
- Angular ngx Bootstrap
- jQuery Mobile
- jQuery EasyUI
- React Bootstrap
- React Rebass
- React Desktop
- React Suite
- ReactJS Evergreen
- ReactJS Reactstrap
- BlueprintJS
- TensorFlow.js
- English Grammar
- School Programming
- Number System
- Trigonometry
- Probability
- Mensuration
- Class 8 Syllabus
- Class 9 Syllabus
- Class 10 Syllabus
- Class 8 Notes
- Class 9 Notes
- Class 10 Notes
- Class 11 Notes
- Class 12 Notes
- Class 8 Maths Solution
- Class 9 Maths Solution
- Class 10 Maths Solution
- Class 11 Maths Solution
- Class 12 Maths Solution
- Class 7 Notes
- History Class 7
- History Class 8
- History Class 9
- Geo. Class 7
- Geo. Class 8
- Geo. Class 9
- Civics Class 7
- Civics Class 8
- Business Studies (Class 11th)
- Microeconomics (Class 11th)
- Statistics for Economics (Class 11th)
- Business Studies (Class 12th)
- Accountancy (Class 12th)
- Macroeconomics (Class 12th)
- Machine Learning
- Data Science
- Mathematics
- Operating System
- Computer Networks
- Computer Organization and Architecture
- Theory of Computation
- Compiler Design
- Digital Logic
- Software Engineering
- GATE 2024 Live Course
- GATE Computer Science Notes
- Last Minute Notes
- GATE CS Solved Papers
- GATE CS Original Papers and Official Keys
- GATE CS 2023 Syllabus
- Important Topics for GATE CS
- GATE 2023 Important Dates
- Software Design Patterns
- HTML Cheat Sheet
- CSS Cheat Sheet
- Bootstrap Cheat Sheet
- JS Cheat Sheet
- jQuery Cheat Sheet
- Angular Cheat Sheet
- Facebook SDE Sheet
- Amazon SDE Sheet
- Apple SDE Sheet
- Netflix SDE Sheet
- Google SDE Sheet
- Wipro Coding Sheet
- Infosys Coding Sheet
- TCS Coding Sheet
- Cognizant Coding Sheet
- HCL Coding Sheet
- FAANG Coding Sheet
- Love Babbar Sheet
- Mass Recruiter Sheet
- Product-Based Coding Sheet
- Company-Wise Preparation Sheet
- Array Sheet
- String Sheet
- Graph Sheet
- ISRO CS Original Papers and Official Keys
- ISRO CS Solved Papers
- ISRO CS Syllabus for Scientist/Engineer Exam
- UGC NET CS Notes Paper II
- UGC NET CS Notes Paper III
- UGC NET CS Solved Papers
- Campus Ambassador Program
- School Ambassador Program
- Geek of the Month
- Campus Geek of the Month
- Placement Course
- Testimonials
- Student Chapter
- Geek on the Top
- Geography Notes
- History Notes
- Science & Tech. Notes
- Ethics Notes
- Polity Notes
- Economics Notes
- UPSC Previous Year Papers
- SSC CGL Syllabus
- General Studies
- Subjectwise Practice Papers
- Previous Year Papers
- SBI Clerk Syllabus
- General Awareness
- Quantitative Aptitude
- Reasoning Ability
- SBI Clerk Practice Papers
- SBI PO Syllabus
- SBI PO Practice Papers
- IBPS PO 2022 Syllabus
- English Notes
- Reasoning Notes
- Mock Question Papers
- IBPS Clerk Syllabus
- Apply for a Job
- Apply through Jobathon
- Hire through Jobathon
- All DSA Problems
- Problem of the Day
- GFG SDE Sheet
- Top 50 Array Problems
- Top 50 String Problems
- Top 50 Tree Problems
- Top 50 Graph Problems
- Top 50 DP Problems
- Solving For India-Hackthon
- GFG Weekly Coding Contest
- Job-A-Thon: Hiring Challenge
- BiWizard School Contest
- All Contests and Events
- Saved Videos
- What's New ?
- Tensorflow.js
- Web Development
- Web Technology
Related Articles
- Write Articles
- Pick Topics to write
- Guidelines to Write
- Get Technical Writing Internship
- Write an Interview Experience
Creating custom domain name instead of localhost in Ubuntu
- How to Install php-curl in Ubuntu ?
- How to enable cURL in PHP?
- PHP | Coding Standards
- PHP | Basic Syntax
- PHP echo and print
- PHP | Variables
- PHP | Data Types
- PHP | Superglobals
- PHP | Constants
- PHP Defining Constants
- PHP | Decision Making
- PHP | Loops
- PHP | Functions
- PHP | Arrays
- PHP | Types of Errors
- PHP | Namespace
- PHP | Strings
- PHP | Objects
- PHP | Classes
- PHP | Serializing Data
- Exception Handling in PHP
- Tree Traversals (Inorder, Preorder and Postorder)
- SQL | Join (Inner, Left, Right and Full Joins)
- find command in Linux with examples
- What is Memory Leak? How can we avoid?
- Asymptotic Notation and Analysis (Based on input size) in Complexity Analysis of Algorithms
- Commonly Asked Data Structure Interview Questions | Set 1
- How to write a Pseudo Code?
- Last Updated : 11 Jul, 2022
In ubuntu, the local server by default is referred by the name “localhost”. However, you can also create a custom domain name for your local server instead of using localhost . This article explains the process to create your own custom domain name instead of using localhost . Here ‘hackdx.md’ is created as our domain, which can be taken as per need.
Note: This article is compiled focusing on Linux users but the process is similar for windows user with some minor changes.
Below are the steps to create your own custom domain name instead of using localhost, in Ubuntu :
sudo apt-get update sudo apt-get install apache2 php
You can check your server by typing ‘localhost’ into your browser. If you get apache ubuntu default page i.e you have successfully installed apache2 server.
sudo apt-get install xed
sudo xed /etc/hosts
- Enter your domain name in front of localhost IP as given in the figure. Here we are using hackdx.md, so we are writing ‘127.0.1.1 hackdx.md’. Now you can see default apache page by typing hackdx.md in your browser.
This can be done with the below command:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/hackdx.md.conf
sudo xed /etc/apache2/sites-available/hackdx.md.conf
sudo a2dissite 000-default.conf sudo a2ensite hackdx.md.conf sudo systemctl reload apache2
Run this command to edit apache2.conf
sudo xed /etc/apache2/apache2.conf
Add these lines to your apache2.conf file as given in the figure.
sudo systemctl reload apache2
Now you can put your files in www directory and enjoy using the PHP server.
Please Login to comment...
- Web Technologies
Improve your Coding Skills with Practice
Start your coding journey now.

IMAGES
VIDEO
COMMENTS
1. You need to acquire a domain name (or maybe just FQDN) from some DNS provider. 2. Once you have registered the domain name, you will gain
The host command is a DNS lookup utility used to convert domain names to IP addresses and reverse IP lookup. The command comes preinstalled with
Procedure · If the entry for localhost in /etc/hosts as follows: 127.0.0.1 <hostname>.<domainname> <hostname> localhost.localdomain localhost. Change the
I'n not sure exactly what you're asking, but if you just want to know how to look up a domain name associated with an IP address, you can use dig -x to do a
Configure the /etc/named.conf file · Define the forward and reverse zones · Create forward and reverse zone files · Add the nameserver IP to /etc/resolv.conf.
Go to your router, go to DHCP settings, find 'address range' and change it from 192.168.0.1–255 to 192.168.2.1–255. You will have to reboot or reconnect all
If you want to access your website with a domain name rather than an IP address which is ... How to set up a virtual Host on an Nginx?
One of the questions that many Linux users ask is how they can retrieve a system's hostname using its IP address. It may seem an uphill task
Install 'xed' if not already done using: sudo apt-get install xed · Then Execute this command to edit the hosts file. sudo xed /etc/hosts · Enter
When you make a PPP connection, you need to tell your Linux machine where it can get host name to IP number (address resolution) information so that you can use