I'm trying to duplicate a live site onto a localhost and I am getting maddening results.
There is no better answer then if you follow online tutorials and keep trying and search with the error on internet and mostly go for stack overflow solutions people there are really very helpful with absolute correct solutions.
"localhost" is not a topic. With that aside, I think your real problem is you are trying to jump stairs too fast.
When doing something for the first time, you have to start simple. Running a server on the local machine requires knowledge of several different things.
Each one of these topics can have its own sub topics that require further investigation if you're not already familiar with them.
So the answer to your question is to start simple. Break the problem down, figure out the simplest subset you can handle at a time, and tackle that. Once you figure it out, tackle the next step.
'localhost' is the DNS name of the IPv4 address 127.0.0.1, which is reserved on every computer system to point to itself. DNS lookups, if you type domain.com in your browser or any other app on your computer, or if you type localhost, are translated by your operating system.
It first looks in a so-called hosts file (/etc/hosts on linux and on windows in C:\windows\system32\drivers\etc\hosts (mind you, the 'etc' folder might be hidden but you can type the path in the address bar). You need administrator rights to change these files, but you can add a translation yourself in there. Every line is 'ipaddress<space>domainname1<space>domainname2' where domainname2, 3, 4 etc are optional if they point to the same ipaddress. If you forgot you edited this file, websites may start behaving badly, so be careful.
If the domain is not found in the hosts file, the computer goes up the network to it's closest DNS server, and if this server does not know the domain, it contacts it's parent and so on, until the IP address is found that goes with a domain name, and this is send down the chain to the requesting computer. Google for more information on this topic if interested.
Every computer has the '127.0.0.1' ip address, which is only available on the local system, because on another computer this number points to the other computer itself. If you need other computers to be able to contact your local computer, you have to find out what the network IP is of your computer, or maybe even the external internet address of your router and do port forwarding. Google these terms if needed as well.
See also en.wikipedia.org/wiki/Localhost
If you want more help, post all used technologies: linux/windows/mac, which webserver and database, what are you expecting and seeing, where did you put localhost and how are you accessing your site? What errors are in the logs?
Mario Giambanco
Director of User Experience Development
hashnode.com/post/what-kind-of-questions-can-you-…
My #2 point
You've given us nothing to help you with.
Localhost where? Your computer? A cloud computer? Localhost is not necessarily YOUR localhost - it could be localhost on a cloud server.
What OS? Linux? MacOS? Windows? Hell, iPhone and Android phones have localhosts. Jailbreak your phone; you can run a webserver on it.
What are the requirements of the live site? Programming language? Any database? What web server is it running? NodeJS? Apache? Nginx?
localhost is no different then any other site; just that it answers to http(s)://localhost and not domain.com
What problem are you actually having? Can you access the site but it throws an error? Can you not access the site and it throws an error? Was the live site hard coded to a specific domain? You'd have a problem moving a Wordpress site to localhost as Wordpress usually hard codes the domain for routing into it's configs.