Score:0

DocumentRoot wont change -Ubuntu 20 Apache2 on windows wsl2

ca flag

I'm at my wits end here. I've installed Ubuntu on windows with wsl2. I'm trying to setup apache2 to point to /mnt/my/windows/source/code

No matter what I do. DocumentRoot is always /var/www/html I've tried so much, I think I'm going insane.

This is in my apache2.conf *tried this out of desperation

<Directory /mnt/c/Users/me/Development/online-store/web>
    AllowOverride None
    Options Indexes FollowSymLinks
    Require all granted
</Directory>

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

vhost file

<VirtualHost *:80>


    DocumentRoot /mnt/c/Users/me/Development/online-store/web

    DirectoryIndex index.php index.html
    ServerName store.test.domain.ca
    ServerAlias store-*.test.domain.ca

    <Directory "/mnt/c/Users/me/Development/online-store/web">
        AllowOverride all
        Require all granted
    </Directory>

    ErrorLog /var/log/apache2/error.log
    CustomLog /var/log/apache2/access.log combined
</VirtualHost>

I disabled the 000 conf file so only this one is enabled.

When I run sudo apache2ctl -S

VirtualHost configuration:
*:80                   store.test.domain.ca (/etc/apache2/sites-enabled/store.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex rewrite-map: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
ca flag
well i think thats a red herring, all Main roots I look at point there. Can't get passed it saying cannot write to index.html No idea why its saying that because I do not have an index.html anywhere and IO have index.php as my index to load
in flag
Does Apache have permission to access that location? Have you checked that AppArmour is not installed and blocking Apache from the non-standard location?
ca flag
Never heard of appArmour so no. I'm currently moving all windows files to Ubuntu so I don't have to point to windows DIR.
ca flag
Wen back to the basics. I changed the document root of 000-default.conf to /var/www/mysite But it still only goes to /var/www/html I have no idea whats going on!
ca flag
lol apache is creating a index.html file in /var/www dir My hosts file doesn't point to it...
ca flag
everytime i goto store.test it creates a new index.html file index.html.1 index.html.2 I've never encountered this before
Score:0
cn flag

If you've already set up SSL then you may be having the same problem I just had. [/sites-available/default-ssl.conf] and whichever other SSL relevant documents need to be updated as well. Restart apache service, and immediately pointed to the correct directory.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.