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

[WSL2] ServerName not working in apache2 #4656

Closed
ghost opened this issue Nov 7, 2019 · 3 comments
Closed

[WSL2] ServerName not working in apache2 #4656

ghost opened this issue Nov 7, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Nov 7, 2019

Please fill out the below information:

  • Your Windows build number: (Type ver at a Windows Command Prompt)
    10.0.19018.1
  • What you're doing and what's happening: (Copy&paste the full set of specific command-line steps necessary to reproduce the behavior, and their output. Include screen shots if that helps demonstrate the problem.)
  1. in PowerShell: wsl --set-default-version 2
  2. in hosts file, add example.test next to localhost
  3. install Ubuntu from Windows store
  4. sudo apt update && sudo apt upgrade && sudo apt install apache2
  5. sudo nano /etc/apache2/sites-available/000-default.conf
  6. add ServerName example.test to VirtualHost, save file
  7. sudo service apache2 restart
  8. try to open example.test in your browser of choice
  • What's wrong / what should be happening instead:
    I get the ERR_CONNECTION_REFUSED error. If I open localhost, though, I do see the website I intended to open when I opened example.test
    I'd also like to note that in WSL1 this worked correctly.
  • Strace of the failing command, if applicable: (If some_command is failing, then run strace -o some_command.strace -f some_command some_args, and link the contents of some_command.strace in a gist here).
    not applicable
  • For WSL launch issues, please collect detailed logs.
@ghost ghost changed the title ServerName not working in apache2 WSL2: ServerName not working in apache2 Nov 7, 2019
@ghost ghost changed the title WSL2: ServerName not working in apache2 [WSL2] ServerName not working in apache2 Nov 7, 2019
@Biswa96
Copy link

Biswa96 commented Nov 7, 2019

Is the Apache service running after step 7 and before step 8?

@ghost
Copy link
Author

ghost commented Nov 7, 2019

Yes.
I just tried to do what was recommended in #4356, and sadly it did not work either.

@ghost
Copy link
Author

ghost commented Nov 7, 2019

Actually no, what is in #4356 does work. It's just that if you add localhost next to 127.0.0.1 in hosts, it overrides WSL and leads to the error.

@ghost ghost closed this as completed Nov 7, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant