Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Os Build: 18945 Can't access local development via domain name in hosts file #4356

Closed
scrossan-crown opened this issue Jul 30, 2019 · 11 comments
Labels

Comments

@scrossan-crown
Copy link

scrossan-crown commented Jul 30, 2019

I love that localhost has been implimented in 18945 but we also need maping to 127.0.0.1 for use with the hosts file as this still isn't working so I still need to get the ip address each time i boot or shutdown wsl.

@SonicGD
Copy link

SonicGD commented Jul 30, 2019

Hello. We are facing similar problem with wsl2 ports mapped to [::1] and not to 127.0.0.1 cause some of our libraries can't work with ipv6.

@scrossan-crown
Copy link
Author

Is there a way to represent this in the hosts file?

@Drakota
Copy link

Drakota commented Aug 1, 2019

@scrossan-crown You can do this in your hosts file

127.0.0.1 yourdomain.local.com
::1 yourdomain.local.com

@scrossan-crown
Copy link
Author

@Drakota I have tried that but it didn't work for me

@Drakota
Copy link

Drakota commented Aug 1, 2019

@scrossan-crown
At the moment there's alot of issue with localhost being inconsistent and not working sometimes so I think you're affected by this.

See
#4347
#4340

@kingwill101
Copy link

doesn't work for me

127.0.0.1 yourdomain.local.com
::1 yourdomain.local.com

@ghost
Copy link

ghost commented Nov 7, 2019

@Drakota's solution works in 19018

@ZdenekKrcal
Copy link

ZdenekKrcal commented May 28, 2020

@Drakota's solution works in 19018

This works:

127.0.0.1 test.loc www.test.loc
::1 test.loc www.test.loc

Yes, it works now but it is so slow. In WSL 1 loading websites under localhost was really fast but WSL 2 is too slow in this topic. I'm using apache2 + PHP and loading of websites is horrible. Ajax requests are slow too.

Website is stored in /mnt/c/webserver

@ZdenekKrcal
Copy link

It is necessary to move website to linux directory etc /home/username and then website is really fast now. But it would be nice to have same speed in /mnt/c

@Drakota
Copy link

Drakota commented Nov 26, 2020

@ZdenekKrcal For WSL 2, it is necessary to move it to a Linux partition. IIRC they are also working on improving this.

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants