π Ports configuration
Refer to the following links to gist for configuration files concerning the ports configuration,
/etc/apache2/sites-enabled/000-default.conf
π Connection to WSL Apache server from outside (i.e., beyond localhost)
This link provide detailed explanation about the IP address assignment scheme for WSL 2 and we need to follow the instruction there to establish the connection from outside to WSL Apache server. Also, since each time when we launch the WSL, new IP address will be assigned to the virtual system and we have no way to make the IP address static. In this case, we can follow this link to grab the IP address of the virtual WSL system automatically and connect it to our Windows host. The following function can be put in powershell profile file so that we can do the configurations all-in-once,
Function own {
wsl sudo /etc/init.d/mysql start
wsl sudo service apache2 restart
$wsl_ip = (wsl hostname -I).trim()
netsh interface portproxy add v4tov4 listenport=5051 listenaddress=0.0.0.0 connectport=5051 connectaddress=$wsl_ip
}
π Port confliction & Firewall issues
Sometimes, if the connection cannot be established via public IP address (or domain name if configured), there could be multiple reasons. First, we may want to change the Apache configuration to let it listen to another alternative port, since sometimes other services (e.g., Jupyterlab) will take over the port used by Apache. Second, we want to make sure the rule for a specific port is added in Windows Firewall exception (inbound traffic).
π Configure external drive
By default, onwCloud will use β/var/www/owncloud/dataβ as the data directory, where all files would be stored. Also, by default, using external local drive as storage is disabled (for safety reason). To enable this, we can refer to Ref. [3].
References
[1] https://www.how2shout.com/how-to/how-to-install-owncloud-server-on-windows-10-wsl.html
[2] https://lucidar.me/en/owncloud/install-owncloud-server-on-ubuntu-20-04/