LAMP Server - WSL 2 Windows 10 - Virtual Host

Greetings!

RE: configuration of server for “old” development server directory

Having recently discovered WSL 2 for Windows 10, this is my first time attempting to customize the Apache configuration. This is a “new” Win 10 installation as well, but I have an old HDD with years of development work on it.

I want to serve files from the ./htdocs directory on that slave HDD, but I can’t seem to get my .conf file configured correctly. Or, perhaps it’s a folder permissions issue. I’ve had issues configuring Apache under Ubuntu in the past, so I think my syntax is off. I need to do more research, obviously, but maybe someone here can spot what’s not right straight away.

# sites-enabled filename: 000-default.conf
# aka the default Ubnuntu config
# where /var/www/htdocs is a symlink to /mnt/h/apache2/htdocs
<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html
  ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

# sites-enabled filename: 001-htdocs.conf
<VirtualHost *:80>
	DocumentRoot "/var/www/htdocs"
	ServerAlias htdocs
<Directory /var/www/htdocs/>
		AllowOverride All
		Options FollowSymLinks Includes Indexes 
    Require local
</Directory> 
	 ErrorLog ${APACHE_LOG_DIR}/hdrive-error.log
   CustomLog ${APACHE_LOG_DIR}/hdrive-access.log combined
</VirtualHost>

In the past, the code format was more like this, which i also tried without success:

<VirtualHost *:80>
	DocumentRoot "/var/www/htdocs"
	Alias "/htdocs/" "/var/www/htdocs/"
	Alias "/htdocs" "/var/www/htdocs/"
	<Directory "/var/www/htdocs">
		AllowOverride All
		Options FollowSymLinks Includes Indexes 
		Require local
	</Directory>
</VirtualHost>

Any insight will be appreciated. I did create the /var/www/htdocs directory with ${USER} permissions. Thanks for reading!

EDIT:
here’s what i get when i try to load a page:
211116_03.27.PM_GadwinPrintscreen

EDIT2:
My intended function / result here is to be able to access my different development directories mapping them as virtual hosts. is this not the correct way to map different directories on a local server?
e.g.
localhost/htdocs (as intended in the .conf example above)
localhost/some_experiment
localhost/something_else

it works as i want per directory if i modify the 000-default.conf file, but… that seems to be missing the point of what i’m trying to configure. Thanks for reading!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.