Score:0

Virtual host alias doesnt work but localhost:80 does

nc flag

Im trying to set up virtual hosts via apache2 on WSL2. I have my webpage working properly by http://localhost:80 but not under http://myalias.local

I have positive response for ping myalias.local in ubuntu console

etc/hosts from windows

# localhost name resolution is handled within DNS itself.
127.0.0.1       localhost ibexa33v1.local
::1             localhost ibexa33v1.local

etc/hosts from ubuntu

127.0.0.1   localhost   myalias.local
::1 localhost   myalias.local

Ports in ports.conf is added Conf for vhost is created

<VirtualHost *:80>
    ServerName myalias.local
    ServerAlias imyalias.local
    DocumentRoot /home/myuser/myalias/public
    DirectoryIndex index.php

I tried: Restarting apache, mariadb, Double checked the alias spelling, Alias for virtual host using Apache2

babciaexe avatar
nc flag
Also its worth mentioning than its good to check if you use proper link. Using https instead of http may cause similar issues.
Score:0
in flag

On Linux-based systems, the hosts file works best when every domain is on its own line, even when the IPs are the same. This format will work for you:

127.0.0.1   localhost
127.0.0.1   myalias.local

::1 localhost   
::1 myalias.local

There is no need to restart any services after making this change.

babciaexe avatar
nc flag
That fixed the issue. Thanks!
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.