I am using WSL 1 and have this code in /etc/wsl.conf
[boot]
systemd=true
command="service apache2 start;"
When I close bash, WSL shutdowns down within few seconds terminating apache.
Note: If I remove this code run “service apache2 start” in bash and then close, apache2 keeps running properly.
But it’s annoying to start server manually. Any other solution?