HELP! Subdomain Laragon


  • | 464 points

    I'm migrating from XAMPP to Laragon, and I'm finding very difficult to configure the virtual hosts due to the little information that there is about it. In XAMPP httpd-vhost.conf I have this

    <VirtualHost *:80>
        UseCanonicalName Off
        ServerName my-app.mv2
        ServerAlias *.my-app.mv2
        VirtualDocumentRoot "M:/webserver/my-app/%1"
        VirtualScriptAlias "M:/webserver/my-app/%1"
        LogLevel debug
        <Directory "M:/webserver/my-app">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order Allow,Deny
            Allow from all
            Require local
        </Directory>
    </VirtualHost>
    

    So I can access to my project structure using the next subdomains:

    +---my-app
        +---v1 = v1.my-app.local
        +---v2 = v2.my-app.local
        +---en = en.my-app.local
    

    But I can't find the way to get this by editing the file M:\laragon\etc\apache2\sites-enabled\my-app.

    define ROOT "M:/webserver/my-app/"
    define SITE "my-app.local"
    
    <VirtualHost *:80>
        DocumentRoot "${ROOT}"
        ServerName ${SITE}
        ServerAlias *.${SITE}
        <Directory "${ROOT}">
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    

    All the subdomain open the main domain.


  • administrators
    | 122979 points

    @mv2_laragon : Please update the Virtual Host template file in C:/laragon/bin/laragon/tpl

    The update will keep permanently when generating virtual hosts.

    For the auto generated virtual host file, if you want Laragon to respect your changes - remove the auto. prefix.
    Ref: https://laragon.org/docs/pretty-urls.html


  • | 464 points

    Thanks for replying, I found my mistake, I forgot to enable mod_vhost_alias.so in laragon\bin\apache\[version]\conf\httpd.conf that's why VirtualDocumentRoot wasn't a valid directive. Thanks anyway


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.