How to set custom virtual host name in laragon

Viewed 10428

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?

2 Answers

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?

I've found the instructions part that might be useful under a different search: enter link description here

from which:

...At this point, I’ve made a {name}.local, so let’s say, the URL in my wordpress\ directory is http://wordpress.local. You can either set something as you like, or, leave the default one. When launching Auto Virtual Hosts, press Yes to allow any permissions in Windows. These Auto Virtual Hosts automatically edit your hosts file. You no longer need to write the hosts file.

enter image description here

Related