how to change xampp localhost to another domain on mac - macos

I searched a lot but there is no answer for how to change xampp localhost domain to another domain on mac..I've done it in windows before and it was easy but on mac not at all.
this how I try to do it:picture of hosts file
and then I changed vhosts.conf by adding new domain's details too:picture of vhosts.conf

If you did it by the hosts file in windows you can edit /etc/hosts on mac. Add a line with the code 127.0.0.1 mydomain.com. After that restart your mac and try to connect to mydomain.com. It might not work on some browsers, because they have an option named DNS over HTTPS. On firefox you can disable it by going to Menu->Options->General->Network Settings->Settings and disabling it.

Related

/etc/hosts doesn't work for localhost only

What I need:
Localhost points to the IP of my other PC on the local network.
What I tried:
I added "IP localhost" to the /etc/hosts file.
Command ran: "ipconfig /flushdns"
Browser: Edge/Chrome/Internet Explorer
This doesn't work, but if I name it anything else than "localhost" it does actually work.
I know it is something about the DNS, but I read online that the hosts file should overwrite it.
Partly solution
Google OAuth only accepts localhost or example.com as redirect URL. Not being able to use localhost on a different PC for testing, I solved this by using example.com on both the local PC and the second PC. I added the following to the hosts file:
Local PC: 127.0.0.1 example.com
Second PC: IP_OF_LOCALPC example.com
You can then use URL example.com:PORT. This isn't supported by Microsoft OAuth though (I guess I will only use Google Login for developing). Any ideas on how to solve this for Microsoft OAuth are welcome :)
Are you using Chrome?
Chrome has it's own DNS, if you use another browser then it's likely it will work as you expect.
Edit: Confirmed that this is still possible in Safari today on a Mac (26/12/2021). However, browsers appear to be clamping down on this - and are making an effort to make sure that localhost and *.localhost will only ever point to your local machine.

/etc/hosts file not redirecting to local application on mac

I've set up a redirect in the hosts file on my machine that basically points an auth domain to my local project in IIS (when run in Visual Studio for Mac) - however when I type the domain name into Chrome (for example), I get a message saying this site cannot be reached.
The local URL I want this to point to is: http://localhost:44380/ - the live URL I can't reveal for security but lets say for the sake of this example that it's: auth.site.com (the actual URL I'm using is valid and it does load in Chrome)
Here's my hosts file from terminal as it's currently set up:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 auth.site.com
I'm very familiar with windows and how the hosts file works, so from what I know there this would work in windows (I think anyways), is there something I'm missing here because obviously something isn't right?
I would first check where the problem is exactly. I think of the following possible issues:
Hosts file not properly working: Try running ping auth.site.com in a terminal. If you see responses from 127.0.0.1 this should work.
Is access to the port possible, open http://localhost:44380 in your browser. If you see your page, this should work.
Combine the two parts: open http://auth.site.com:44380 in your browser. If this does not work, maybe there are security features from the original page you visited before preventing access (like forcing SSL or a pinned certificate).
Try another browser or curl auth.site.com:44380 in a terminal.
If you are not happy with the given ports, you can do a port forwarding. Changing ports is not possible in the hosts file, because the hosts file is only for domain name lookup and this has nothing to do with the ports.
The listening address on the local instance would be http://auth.site.com:44380/

Laragon, laravel. my virtual host cannot work on my PC

Anyone can helme? i get problem whit virtual host
This is my problem
I solved that issue as follow
Menu -> Apache -> sites-enabled -> delete all (auto)
C:\Windows\System32\drivers\etc\hosts right click -> properties on hosts file and uncheck the "Read-only"
make sure auto virtual host is checked on laragon
restart laragon and try your project folder name inside in www with .test (or as specified in laragon setting) in the browser
This question has entirely insufficient details to help you in any meaningful way. However, if I had to guess, I would say there are couple of possible reasons:
Your DNS for is not configured properly for online-shop.dev. Note, .dev is an actual top-level domain, owned by Google and reserved for their own use - https://icannwiki.org/.dev, so it's likely you are trying to follow some advice how to setup .dev for local development, but Firefox is actually looking against the real .dev DNS servers.
Assuming your DNS is indeed properly configured (in which case you happen to work for Google, and you just accidentally leaked their Amazon competitor :-)), it is possible that your app server is not running. It's impossible to say by the screenshot.
Assuming that the DNS and the app server are configured and running properly, it's possible your firewall is blocking port 80.

How to access vhosts via IPad?

I'm using XAMPP, on Mavericks, to simulate a localhost. I set jobeet.local, for example, as my vhosts. I tried to access it on my computer, it worked as well.
Now, I want to test my website on an IPad. So, I did the following steps:
Run XAMPP server on port 80, as usual
Connect the IPad to my wifi network.
Setup Http Proxy on Ipad, as picture showed below but change the port to 80
Now, I tested to access 127.0.0.1 via IPad. It worked! However, jobeet.local doesn't work.
I have searched and tried many ways to achieve this issue but they don't work.
Could you help me figure it out?
Thanks in advance.
You might have to update the hosts file.
The hosts file is a text file that maps hostnames to IP addresses.
Upon typing a url address on the browser, the system is checking if there is a relevant entry on the hosts file and gets the corresponding IP address, else it resolves the IP via the active connection’s DNS servers.
The hosts file can be edited to block certain hostnames (like ad-serving/malicious hosts), or used for web development purposes, i.e. to redirect domains to local addresses.
Editing the hosts file
Editing the hosts file in Mac OS X – Leopard, is a pretty easy task, especially if you are familiar with the terminal.
Step 1 – Open the Terminal.app
Either by start typing Terminal on the Spotlight, or by going into Applications -> Utilities -> Terminal.
Step 2 – Open the hosts file
Open the hosts by typing on the Terminal that you have just opened:
$ sudo nano /private/etc/hosts
Type your user password when prompted.
Step 3 – Edit the hosts file
The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 – localhost).
Simply append your new mappings underneath the default ones. Or edit one of the default values if you know what you are doing!
You can navigate the file using the arrow keys.
Step 4 – Save the hosts file
When done editing the hosts file, press control-o to save the file.
Press enter on the filename prompt, and control-x to exit the editor.
Step 5 – Flush the DNS cache
On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect:
$ dscacheutil -flushcache
You can now test your new mapping on the browser!
Hope this works for you!
I had to reinstall my setup today and made a step by step at that occasion:
I use a combination of Squidman and Mamp Pro (I assume it's similar to XAMPP)—hope this help anyone in their quest; happy to read feedback or get advice to make this better...
Squidman http://squidman.net/squidman/index.html
Mamp Pro http://www.mamp.info/en/mamp-pro/
on Squidman
- Preferences > General > Http port:
something different from the one MAMP is using (if map uses 80, then put 8080)
Preferences > Clients > Provide proxy service for:
insert the IP address or the subnet we will be catering for
Start Squidman
on MAMP:
setup the hostname, as well as the the website attached
insert the (local) IP address of the local machine
insert the port of Apache on the local machine
start Mamp; check that website is running correctly on local machine
on iPad/iPhone/mobile device
select the same wireless network as the laptop
in Wifi network > Preferences/Information: set a Manual HTTP Proxy
server IP is the (local) IP address of the Apache server, also running Squidman; port is the port used for Squidman
(Extra)
stuff to test: move dev server onto virtual machine (VirtualBox), to use with Node, custom PHP build, etc.
automate the setting: write pref for Squidman, Mamp/hostname, restart the Apache server, send configuration of proxy to mobile via iMessage or email.
I recommend using http://xip.io/. For example (taken from the website):
10.0.0.1.xip.io resolves to 10.0.0.1
www.10.0.0.1.xip.io resolves to 10.0.0.1
mysite.10.0.0.1.xip.io resolves to 10.0.0.1
foo.bar.10.0.0.1.xip.io resolves to 10.0.0.1
It does the job and you don't have to set anything up. I'm only pushing it because I am overly excited that I have wasted time trying over-engineered solutions.
On a mac you can use Squid on Windows that's Fiddler, however I'm having troubles with Fiddler and iPhone at the moment...

Typing http://localhost always redirects me to http://anonym.to

So I'm trying to install a local server to experiment on... Tried Wamp which gave this problem in the title (or so I thought).
Instead, I then tried installing Apache, and Xampp. Everything seems fine again. But when I type http://localhost into my browser (firefox, but for what it's worth the same thing happens with IE) it just redirects me to http://anonym.to/.
Anyone know why?
That's some kind of anonymizer site that acts as a proxy server to browse anonymously. You should probably check your /etc/hosts file to see if there is a redirect going on there for localhost or 127.0.0.1.
Either you have an entry in your Windows Hosts file %SystemRoot%\system32\drivers\etc\hosts (entry which you can delete by editing this file) or your browser has proxy settings set (which you can unset).

Resources