"Connection was reset" accesing apache2 virtualhost through wsl1 and /etc/hosts

Moonraker890 asked:

I am new with linux but am trying to install koha (a library management system) through Debian 10 on my laptop using windows 10 ver.1903 (build 18362.900) and wsl1 as a test for installing it in my library.

I followed the instructions here: https://wiki.koha-community.org/wiki/Koha_on_Debian and managed to get up to installing apache2. The version I have is apache 2.4.38

I then set up the domain through virtual hosts using this: https://wiki.koha-community.org/wiki/How_to_set_up_a_domain_name_for_Koha.

So debian /etc/hosts file was setup like so (I also put the same in the windows /etc/hosts file): localhost LAPTOP.localdomain LAPTOP
192.168.x.y lmc.mydomain.org
192.168.x.y lmc.mydomain.org

However when I try to access it through the browser Firefox says "Connection was reset." localhost loads the apache2 default webpage correctly however, and when I input the ip directly, it loads the default apache2 web page instead.

Here is the apache2/sites-enabled/lmc.conf file generated by koha


apache2ctl -S shows the proper domain (rootfile) relationships:

VirtualHost configuration:
*:80 is a NameVirtualHost
default server LAPTOP.localdomain (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost LAPTOP.localdomain (etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost lmc.mydomain.org (/etc/apache2/sites-enabled/library.conf.:4)
port 80 namevhost lmc.mydomain.org(/etc/apache2/sites-enabled/library.conf:22)

apache2/error.log shows the following whenever I try to connect through browser:

[timestamp]  [mpm_itk:warn] [pid 82] (itkmpm:pid=82 uid=33, gid=33)  itk_post_perdir_config() : initgroups(library-koha), 1001) : Operation  not permitted
[timestamp] [mpm_itk:warn] [pid 82] Couldn't set uid/gid/priority, closing connection.

When I start apache2 it shows:

apache2[timestamp] [core:warn] [pid139] (92)Protocol not available : AH00076: Failed to enable APR_TCP_DEFER_ACCEPT

However since it shows green ok, I figured that particualar warning is ok to ignore..? localhost default webpage works correctly anyhow.

I tried clearing the cache, added exceptions/turned off windows firewall and antivirus but those didn’t work.

I’m pretty much been stuck by more than a week on what to do, could someone please provide me some help on how I proceed? I don’t need ssh connection (through that would be a bonus), just need it to work locally (hence the use of /etc/hosts). Any help would be much appreciated, thank you!

My answer:

Why are you using mpm_itk? This doesn’t work on WSL (and probably never will) as the error messages indicate. I also don’t see anything in the wiki you linked to that would explain why it is necessary.

You should remove this package:

apt purge libapache2-mpm-itk
a2enmod mpm_prefork

If you really intentionally installed mpm_itk for a specific reason, then you should stop using WSL and create a virtual machine instead. You should probably do that anyway.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.