Search code examples
apachelaragon

How to set custom virtual host name in laragon


I've a project named 'my-new-project' (that's just an example). With laragon auto virtual host name feature, i can browse this project via http://my-new-project.test/

Is it possible to browse this project with another name instead of this project name like... http://project.test/?

Also, what is ServerName and ServerAlias located in .conf file inside C:\laragon\etc\apache2\sites-enabled?


Solution

  • The simple solution is to trick! Create another folder with the name project next to the my-new-project folder. Then go to C:\laragon\etc\apache2\sites-enabled path and edit auto.project.test.conf. Edit these:

    <VirtualHost *:80> 
    DocumentRoot "C:/laragon/www/project"
    ServerName project.test
    ServerAlias *.project.test
    <Directory "C:/laragon/www/project">
        AllowOverride All
        Require all granted
    </Directory>
    

    to these:

    <VirtualHost *:80> 
    DocumentRoot "C:/laragon/www/my-new-project"
    ServerName project.test
    ServerAlias *.project.test
    <Directory "C:/laragon/www/my-new-project">
        AllowOverride All
        Require all granted
    </Directory>
    
    This is the simple way.

    and for this question:

    Also, what is ServerName and ServerAlias located in .conf file inside C:\laragon\etc\apache2\sites-enabled?

    go to this link: What is the difference between ServerName and ServerAlias in apache2 configuration?